@dosx/agent-memory 0.0.13

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 (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +142 -0
  3. package/bin/agent-memory.js +496 -0
  4. package/hooks/README.md +292 -0
  5. package/hooks/agent-memory-hooks/agent-memory-common.sh +1020 -0
  6. package/hooks/agent-memory-hooks/agent-memory-session.sh +98 -0
  7. package/hooks/agent-memory-hooks/agent-memory-sync.sh +147 -0
  8. package/hooks/claude-code/settings.json +51 -0
  9. package/hooks/codex/config.toml.snippet +38 -0
  10. package/hooks/codex/hooks.json +51 -0
  11. package/hooks/copilot/agent-memory.json +34 -0
  12. package/hooks/cursor/hooks.json +36 -0
  13. package/hooks/gemini/settings.json +50 -0
  14. package/hooks/git/pre-commit +45 -0
  15. package/hooks/install-hooks.sh +358 -0
  16. package/hooks/opencode/agent-memory.ts +320 -0
  17. package/package.json +22 -0
  18. package/skills/agent-memory/SKILL.md +185 -0
  19. package/skills/agent-memory/references/agent-block.md +115 -0
  20. package/skills/agent-memory/references/bootstrap.md +84 -0
  21. package/skills/agent-memory/references/init.md +211 -0
  22. package/skills/agent-memory/references/install-hooks.md +113 -0
  23. package/skills/agent-memory/references/lint.md +113 -0
  24. package/skills/agent-memory/references/sync.md +120 -0
  25. package/skills/agent-memory/references/update.md +145 -0
  26. package/skills/agent-memory/vendor/README.md +132 -0
  27. package/skills/agent-memory/vendor/UPDATE.md +369 -0
  28. package/skills/agent-memory/vendor/memory/active-work/TEMPLATE.md +33 -0
  29. package/skills/agent-memory/vendor/memory/current.md +34 -0
  30. package/skills/agent-memory/vendor/memory/decisions.md +30 -0
  31. package/skills/agent-memory/vendor/memory/index.md +55 -0
  32. package/skills/agent-memory/vendor/memory/instructions.md +340 -0
  33. package/skills/agent-memory/vendor/memory/log.md +38 -0
@@ -0,0 +1,369 @@
1
+ # agent-memory — Update migrations
2
+
3
+ Migration log for `/agent-memory update`. One section per released version,
4
+ newest at the bottom. Each line is a single change tagged `safe` or `sensitive`:
5
+
6
+ - `safe` — pure addition or a scaffolding change with no user content at risk.
7
+ `update` may apply it automatically.
8
+ - `sensitive` — touches a file that can hold user content, or renames/moves/
9
+ deletes anything. `update` must show a diff and get confirmation first.
10
+
11
+ Format:
12
+
13
+ ```md
14
+ ## <version>
15
+
16
+ - safe: <change>
17
+ - sensitive: <change>
18
+ ```
19
+
20
+ ---
21
+
22
+ ## 0.0.1
23
+
24
+ - safe: initial baseline — no migrations.
25
+
26
+ ## 0.0.2
27
+
28
+ - safe: add `sync` command (`references/sync.md`) — refreshes `current.md`, the
29
+ branch's `active-work/<branch>.md`, `log.md`, and the Domains/Features lists
30
+ of `index.md` from repo state. New command in the skill only; no existing
31
+ memory file is renamed or moved.
32
+ - safe: `SKILL.md` routing and help updated to list `sync`.
33
+ - sensitive: `instructions.md` — the _Workflow_ section now names
34
+ `/agent-memory sync` as the executable trigger for the _During_ / _After_ /
35
+ _Flush early_ steps. `update` must show the diff and confirm.
36
+
37
+ ## 0.0.3
38
+
39
+ - safe: unify the agent-file stub in `references/init.md` — `AGENTS.md` now gets
40
+ the same stub as `CLAUDE.md` / `GEMINI.md`, with both the explicit always-load
41
+ list and `@.agents/memory/instructions.md`. Covers harnesses that read
42
+ `AGENTS.md` via `@import` (Claude Code, Gemini CLI, Codex) and those that read
43
+ it as plain Markdown (Cursor).
44
+ - safe: `agent-memory/README.md` and root `README.md` — the documented stub is
45
+ now the single unified one.
46
+
47
+ ## 0.0.4
48
+
49
+ - safe: wrap the memory block in `AGENTS.md` / `CLAUDE.md` / `GEMINI.md` with
50
+ `<agent-memory>` … `</agent-memory>` delimiters (`references/init.md`), so the
51
+ block is machine-identifiable.
52
+ - sensitive: `references/update.md` — `update` now refreshes **only** the
53
+ `<agent-memory>` block in the root agent files (replacing it with the
54
+ canonical block), and migrates legacy `## Agent Memory` sections into the
55
+ delimited block. Never touches content outside the delimiters. Show the diff
56
+ and confirm before applying.
57
+ - safe: `agent-memory/README.md` and root `README.md` — the documented stub is
58
+ now the delimited block.
59
+ - safe: extract the canonical `<agent-memory>` block into a new reference,
60
+ `references/agent-block.md`, as the single source of truth.
61
+ - safe: `references/init.md` and `references/update.md` now reference
62
+ `agent-block.md` instead of inlining the block text. `update` compares the
63
+ installed block against the canonical block byte-for-byte and skips when
64
+ identical.
65
+
66
+ ## 0.0.5
67
+
68
+ - sensitive: `references/agent-block.md` — the canonical `<agent-memory>` block
69
+ now instructs the agent to **Read** `.agents/memory/instructions.md` (not just
70
+ "open and follow") and spells out the read-AND-write obligation (keep
71
+ `active-work`, `log.md`, `decisions.md`, `current.md` current; delete
72
+ `active-work` on merge; run `/agent-memory sync` at checkpoints). Fixes the
73
+ case where plain-Markdown harnesses (Cursor) never load `instructions.md` via
74
+ `@import` and so never maintain the memory. `update` compares the block
75
+ byte-for-byte and will propose the refresh as a sensitive diff.
76
+ - safe: `references/agent-block.md` — "Why both the read list and `@import`"
77
+ rewritten to explain the Cursor/plain-Markdown load path. No file rename or
78
+ move.
79
+ - sensitive: `agent-memory/memory/instructions.md` — the _Flush early_ section
80
+ now names `Read` as the load verb, calls out `sync --auto` for low-friction
81
+ checkpoints, and adds a _Cursor and other plain-Markdown harnesses_ note.
82
+ - safe: `references/sync.md` — documents the `--auto` flag (apply all proposed
83
+ diffs without per-file `AskQuestion`), plus an `--auto` steps variant. No
84
+ existing file renamed or moved.
85
+ - safe: `references/lint.md` — documents `--fix` for the safe removal of stale
86
+ per-branch `active-work` files (branch gone). Confirms each deletion.
87
+ - safe: `agent-memory/README.md` and root `README.md` — rewritten as clearer
88
+ entry points (Quick start, "How agents use it", "Keeping the memory current"
89
+ with a hooks link). They no longer inline the `<agent-memory>` stub; both
90
+ point to `references/agent-block.md` as the single source, which removes the
91
+ doc/canonical drift for good.
92
+ - safe: add `skills/agent-memory/hooks/` with opt-in flush-reminder hooks for
93
+ Cursor, Claude Code, Codex, OpenCode, Copilot (CLI + cloud agent), plus a
94
+ host-agnostic git `pre-commit` reminder and a shared reminder script. Hooks
95
+ are non-blocking reminders only — they never write to the memory, never block
96
+ the agent, and recommend `/agent-memory sync` (per-file confirmed), not
97
+ `--auto`, so they cannot cause memory inconsistency or loops. Includes a
98
+ `README.md` with a per-host matrix and install instructions. Optional, opt-in;
99
+ not wired by `init`.
100
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.5`; `help` text
101
+ mentions `--auto` and `--fix`.
102
+ - sensitive: `references/agent-block.md` — delimiters changed from plain
103
+ `<agent-memory>` … `</agent-memory>` tags to HTML comments
104
+ `<!-- <agent-memory> -->` … `<!-- </agent-memory> -->` so the block is
105
+ machine-identifiable but invisible in rendered Markdown. `update` compares the
106
+ block byte-for-byte and will propose the refresh as a sensitive diff; it also
107
+ migrates legacy plain-tag blocks to the comment form.
108
+ - safe: `references/init.md`, `references/update.md`, `SKILL.md`, root
109
+ `README.md`, `agent-memory/README.md`, and `instructions.md` — documentation
110
+ updated for the new delimiters and legacy migration path. No file rename or
111
+ move.
112
+
113
+ ## 0.0.6
114
+
115
+ - safe: `references/init.md` — `init` accepts an optional harness target
116
+ (`init cursor`, `init claude`, `init codex`, `init opencode`, `init copilot`,
117
+ `init gemini`) or auto-detects from existing agent files and harness dirs.
118
+ Wires shared lifecycle hooks into existing harness dirs only (never creates
119
+ `.cursor/`, `.claude/`, etc.).
120
+ - safe: add `hooks/shared/agent-memory-sync.sh` and
121
+ `hooks/shared/agent-memory-session.sh` — deterministic git checkpoint (Touched
122
+ files + conservative `log.md` append; no LLM). Replaces flush-reminder hooks
123
+ (`agent-memory-flush.sh` removed).
124
+ - safe: unify harness hooks on the shared scripts — Cursor (`sessionStart`,
125
+ `postToolUse`, `afterAgentResponse`, `preCompact`; no `stop` +
126
+ `followup_message`), Claude Code (`SessionStart`, `PostToolUse`, `Stop`,
127
+ `PreCompact`), Codex, Copilot, OpenCode plugin, git `pre-commit`.
128
+ - safe: Cursor integration is **hooks-only** — no
129
+ `.cursor/rules/agent-memory.mdc` ( `@import` in `AGENTS.md` remains a no-op).
130
+ Root `README.md` and `hooks/README.md` document hooks as the recommended
131
+ Cursor path.
132
+ - sensitive: `agent-memory/memory/instructions.md` — _Plain-Markdown harnesses_
133
+ section updated for hooks-only Cursor integration.
134
+ - safe: `references/update.md` — drop Cursor rule refresh step; note optional
135
+ removal of legacy `.cursor/rules/agent-memory.mdc`.
136
+ - safe: `references/agent-block.md`, root `README.md`, `agent-memory/README.md`,
137
+ `SKILL.md` help/routing/allowed-tools — aligned with harness `init` and
138
+ unified hooks.
139
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.6`.
140
+ - safe: add `agent-memory/memory/.gitignore` — ignores hook checkpoint state
141
+ (`.hook-sync-state`). Shipped with the skeleton; `init` copies it; `update`
142
+ creates it when missing.
143
+
144
+ ## 0.0.7
145
+
146
+ - safe: add `hooks/shared/agent-memory-common.sh` — shared helpers sourced by
147
+ sync and session hooks (session ID, log headings, active-work/current.md
148
+ refresh). `init` must copy all three shared scripts together.
149
+ - safe: refactor `agent-memory-sync.sh` and `agent-memory-session.sh` to source
150
+ `agent-memory-common.sh`; session hook refreshes `current.md` _In progress_ on
151
+ session start.
152
+ - safe: hooks append file-path bullets under per-session `log.md` headings
153
+ (session ID when available); no-id sessions and session-ID promotion from
154
+ type-tag headings.
155
+ - safe: OpenCode plugin bridges session start to `agent-memory-session.sh`;
156
+ install all three shared scripts under `.opencode/hooks/`.
157
+ - safe: `references/init.md`, `hooks/README.md`, `SKILL.md` allowed-tools —
158
+ three-script hook install documented.
159
+ - sensitive: `agent-memory/memory/instructions.md` — _Obligations by file_
160
+ section (hook vs agent per file); per-session `log.md` contract.
161
+ - sensitive: `agent-memory/memory/log.md` — per-session heading format
162
+ (`## [date] [session-id] [type] summary`).
163
+ - sensitive: `agent-memory/memory/decisions.md` — mandatory ADR-style recording
164
+ when decisions change.
165
+ - sensitive: `agent-memory/memory/current.md`, `index.md`,
166
+ `active-work/TEMPLATE.md` — clearer hook vs agent responsibilities.
167
+ - sensitive: `references/agent-block.md` — obligations aligned with
168
+ `instructions.md`.
169
+ - safe: `references/bootstrap.md`, `references/sync.md` — vision gate,
170
+ per-session log format, `index.md` alignment.
171
+ - safe: `agent-memory/memory/.gitignore` — drop legacy `.cursor-hook-state`
172
+ entry.
173
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.7`.
174
+
175
+ ## 0.0.8
176
+
177
+ - sensitive: hooks scripts directory renamed from `hooks/shared/` to
178
+ `hooks/agent-memory-hooks/`. All three canonical scripts now live under the
179
+ new path. `install hooks`, `update`, and manual copy instructions updated.
180
+ Projects with manually copied old-path scripts must re-install from the new
181
+ location.
182
+ - safe: `parse_hook_stdin` prefers `jq` when present (with sed fallback) for
183
+ robust extraction of `session_id`/`conversation_id`/`sessionId`, `cwd`,
184
+ `tool_name`, and `tool_input.file_path`.
185
+ - safe: `postToolUse` is git-free for file edits — it records the path supplied
186
+ by the harness via stdin (`Write`/`Edit` tool_input). `Shell` invocations are
187
+ no-ops at this stage (reconciled later).
188
+ - safe: branch name is cached at session start and full checkpoints
189
+ (`refresh_branch_cache`); `sanitize_branch` and postToolUse no longer run
190
+ `git branch --show-current`.
191
+ - safe: new `add_touched_file` helper for incremental Touched files updates from
192
+ single file paths (used by the git-free postToolUse path).
193
+ - safe: full Gemini CLI hooks support:
194
+ - new `hooks/gemini/settings.json` (SessionStart, AfterTool, AfterAgent,
195
+ PreCompress)
196
+ - `GEMINI_PROJECT_DIR` and `GEMINI_SESSION_ID` recognized
197
+ - dedicated `gemini` host handling in `agent-memory-session.sh` (strict JSON
198
+ output per Gemini CLI rules)
199
+ - safe: removed postToolUse debounce helpers (`should_skip_posttool`,
200
+ `files_hash`, related state keys) — no longer needed.
201
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.8`.
202
+ - safe: documentation refreshed (`hooks/README.md`,
203
+ `references/install-hooks.md`, `init.md`, `SKILL.md` help text, harness
204
+ snippets, etc.) for new directory layout and Gemini support.
205
+
206
+ ## 0.0.9
207
+
208
+ - safe: `init` writes the agent-memory block into each harness's **native
209
+ instruction file** — Cursor `.cursor/rules/agent-memory.mdc`
210
+ (`alwaysApply: true`), Copilot
211
+ `.github/instructions/agent-memory.instructions.md`, claude/codex/opencode/
212
+ gemini via their agent files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`).
213
+ - safe: `init` without `<harness>` **auto-detects** harnesses from project file
214
+ markers (`CLAUDE.md`, `GEMINI.md`, `.cursor/rules/`, Copilot markers,
215
+ `AGENTS.md` + `.codex/` or `.opencode/`); asks the user when detection is
216
+ inconclusive.
217
+ - safe: **carrier-file resolution** — when `CLAUDE.md`/`GEMINI.md` delegates via
218
+ `@AGENTS.md`, write the block once in `AGENTS.md` (claude+opencode canary);
219
+ skip the delegating file.
220
+ - safe: **Copilot coexistence** — when `AGENTS.md` is already a carrier for
221
+ codex/opencode/claude-via-delegation, skip creating
222
+ `.github/instructions/agent-memory.instructions.md` (Copilot loads `AGENTS.md`
223
+ too).
224
+ - safe: `update` refreshes blocks in `.cursor/rules/agent-memory.mdc` and
225
+ `.github/instructions/agent-memory.instructions.md` (body only; preserve
226
+ frontmatter — `alwaysApply: true` for Cursor, `applyTo: "**"` for Copilot).
227
+ - safe: Copilot `.instructions.md` requires `applyTo: "**"` frontmatter to be
228
+ always-on (path-specific files apply only to files matching `applyTo`);
229
+ without it the block may never reach the model. Documented in `agent-block.md`
230
+ and wired by `init`.
231
+ - safe: `init` enforces **prerequisite harness dirs** for cursor/copilot natives
232
+ (`.cursor/`, `.github/`) — does not create harness roots by default; stops and
233
+ asks the user, creating the root only on explicit request. Subdirectories
234
+ (`.cursor/rules/`, `.github/instructions/`) may be created inside an existing
235
+ (or explicitly created) harness dir.
236
+ - safe: auto-detection recognizes `.claude/` and `.gemini/` (dirs) as secondary
237
+ markers alongside `CLAUDE.md` / `GEMINI.md`.
238
+ - safe: `update` report suggests `init <harness>` when hooks are wired but the
239
+ native instruction file is missing (e.g. `.cursor/hooks/` present,
240
+ `.cursor/rules/agent-memory.mdc` absent).
241
+ - safe: `lint` instruction-wiring checks run from the **project root** (not
242
+ `.agents/memory/`); `test -o` replaced with `|| test` for POSIX portability.
243
+ - safe: root `README.md`, `agent-memory/README.md`, and `hooks/README.md`
244
+ updated for per-harness natives, auto-detection, and the Cursor/Copilot
245
+ context-vs-checkpoint layers.
246
+ - safe: `references/init.md`, `references/update.md`,
247
+ `references/agent-block.md`, `references/lint.md`, `SKILL.md` (0.0.9,
248
+ allowed-tools, write boundary), and help text aligned with per-harness natives
249
+ and auto-detection.
250
+ - sensitive: `update` may **move** the block from `AGENTS.md` to cursor/copilot
251
+ natives for older installs (when `AGENTS.md` is not a shared carrier); show
252
+ diff and confirm.
253
+ - sensitive: `update` may **remove** duplicate blocks from
254
+ `CLAUDE.md`/`GEMINI.md` that delegate via `@AGENTS.md` when `AGENTS.md`
255
+ already has the block (delegation canary cleanup); show diff and confirm.
256
+ - sensitive: reverts 0.0.6 "Cursor hooks-only, no `.mdc`" — `.mdc` reintroduced
257
+ as the **context layer** (always-on rules); hooks remain the **checkpoint
258
+ layer**. `instructions.md` _Plain-Markdown harnesses_ updated.
259
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.9`.
260
+
261
+ ## 0.0.10
262
+
263
+ - safe: **session-cumulative _Touched files_** — hooks accumulate paths in
264
+ `.hook-sync-state` (`session_touched_files`) for the active session instead of
265
+ replacing the section with each git delta; full checkpoints flush even when
266
+ the working tree is clean.
267
+ - safe: **`postToolUse` / `afterFileEdit` no longer write `log.md` bullets** —
268
+ file-path bullets are appended only on full checkpoints
269
+ (`afterAgentResponse`, `preCompact`, `precommit`, etc.); semantic bullets
270
+ remain agent-owned (`/agent-memory sync`).
271
+ - safe: after a summary bullet (`changed N files…`), suppress further
272
+ individual path bullets in the same session (`log_summary_mode`).
273
+ - safe: shared stdin parser accepts `tool_input.file_path`, `tool_input.path`
274
+ (Copilot), and top-level `file_path` (Cursor `afterFileEdit`).
275
+ - safe: **Gemini event mapping** — `AfterTool` → post-tool accumulate;
276
+ `AfterAgent` / `PreCompress` → full git checkpoint (was misrouted to
277
+ end-of-turn default).
278
+ - safe: **branch switch** clears session path accumulation when the cached branch
279
+ changes mid-session.
280
+ - safe: fix first no-id sync clearing `session_touched_files` immediately after
281
+ merge (regression from 0.0.8 path-state reset).
282
+ - safe: `hooks/cursor/hooks.json` adds **`afterFileEdit`** (Cursor agent edits
283
+ fire this hook with top-level `file_path`; `postToolUse` matches `Write|Shell`
284
+ only per Cursor docs).
285
+ - safe: `hooks/README.md`, `references/install-hooks.md`, `instructions.md`, and
286
+ `AGENTS.md` (Known issues) updated for hook checkpoint behavior and consumer
287
+ upgrade path.
288
+ - sensitive: **`update` / `install hooks cursor`** must merge `afterFileEdit` into
289
+ the project's `.cursor/hooks.json` when refreshing Cursor hooks — show diff
290
+ and confirm if the user has custom hook entries. **Superseded** — hooks refresh
291
+ is user-run installer only (skill prints instructions; no agent merge).
292
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.10`.
293
+
294
+ ## 0.0.11
295
+
296
+ - safe: **OpenCode log heading coalescence** — one `log.md` heading per calendar
297
+ day when `ses_*` IDs rotate; `opencode_log_heading_id` in `.hook-sync-state`
298
+ maps later IDs to the bound heading.
299
+ - safe: **`ensure_log_heading_for_checkpoint`** — creates the session heading in
300
+ `log.md` before appending bullets or binding state (state-only binding no
301
+ longer leaves orphan headings).
302
+ - safe: **`normalize_session_id_for_checkpoint`** — read-only ID resolution; does
303
+ not write `.hook-sync-state` without a corresponding heading.
304
+ - safe: **`prune_empty_opencode_session_headings`** — removes duplicate empty
305
+ same-day `ses_*` headings when binding the canonical day heading.
306
+ - safe: OpenCode plugin — skip redundant `sessionStart` when the bound heading
307
+ **exists in `log.md`**; compaction runs sync only (no synthetic session start).
308
+ - safe: `hooks/README.md` — canonical paths under `agent-memory-hooks/`; link to
309
+ harness parity contract (do not duplicate the contract text).
310
+ - safe: `references/sync.md` — links to _Harness parity — memory contract_ in
311
+ `instructions.md`.
312
+ - safe: root `AGENTS.md` — harness parity single source of truth; OpenCode empty
313
+ heading fix documented for this repo's dogfooding.
314
+ - sensitive: `agent-memory/memory/instructions.md` — new _Harness parity — memory
315
+ contract_ section (hooks vs agent writes, evidence vs meaning split, harness
316
+ timing table, OpenCode heading rule). `update` must show the diff and confirm.
317
+ - sensitive: `agent-memory/memory/log.md` — OpenCode coalescence note under the
318
+ per-session heading rules. `update` must show the diff and confirm.
319
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.11`.
320
+
321
+ ## 0.0.12
322
+
323
+ - safe: **Vendor + dual installers** — memory skeleton / `UPDATE.md` under
324
+ `skills/agent-memory/vendor/`; lifecycle hooks under repo-root `hooks/`;
325
+ `hooks/install-hooks.sh` + `bin/agent-memory.js` (`npx`) for user-run install.
326
+ Skill prints hook-install instructions only (no agent-side hook copy/merge).
327
+ Repo-root `agent-memory/` path removed — edit `skills/agent-memory/vendor/`
328
+ only (older UPDATE entries that say `agent-memory/memory/…` map to
329
+ `vendor/memory/…`).
330
+ - safe: Installer refuses destination **and parent-directory symlinks**; copies
331
+ shared scripts before merging host JSON; requires existing `PROJECT_DIR` then
332
+ `realpath`.
333
+ - safe: Runtime hooks refuse `.agents/memory` symlink escape, symlink paths under
334
+ memory, and symlink `.hook-sync-state`; `write_state` accepts RS (`\x1e`)
335
+ multi-value delimiters.
336
+ - safe: **Supersedes 0.0.10 sensitive** — Cursor `afterFileEdit` / hooks.json
337
+ refresh is **user-run installer only** (`npx` / `install-hooks.sh`); the
338
+ skill prints instructions and does not agent-merge hook config.
339
+ - safe: Nested / flat JSON merge matches product script path tokens only (not
340
+ bare filename mentions); preserves sibling custom hooks in nested groups.
341
+ - safe: CLI `shell: false`, validates `--agent` charset, expanded env allowlist
342
+ (Windows / `XDG_*` / `GIT_CONFIG_*`); OpenCode plugin allowlist aligned.
343
+ - safe: `write_state` / `normalize_repo_rel_path` reject newlines and `..` path
344
+ segments; `normalize_repo_rel_path` also rejects `\x1e` in individual paths;
345
+ `pre-commit` uses `git rev-parse --show-toplevel`.
346
+ - safe: `ensure_active_work` prefers branch cache; `add_touched_file` no-ops when
347
+ the path is already in `session_touched_files`; full checkpoints normalize
348
+ git paths before merging session state.
349
+ - safe: Cross-package docs pin `hooks/README.md` / `npx` examples to `v0.0.12`.
350
+ - safe: root `README.md` — `skills add` primary; pinned `npx` for hooks / alt skill.
351
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.12`.
352
+ - safe: root `package.json` — version bumped to `0.0.12`.
353
+
354
+ ## 0.0.13
355
+
356
+ - safe: npm package renamed to `@dosx/agent-memory` (was unscoped `agent-memory`).
357
+ CLI is hooks-only; skill install is via
358
+ `npx skills add diegoos/agent-memory#<version> --skill agent-memory`.
359
+ `install skill` redirects interactively; `install <harness>` shows a TTY menu.
360
+ Removed CLI skill flags and `install hook` alias.
361
+ - safe: `runSkillsAdd` uses tag-pinned remote source
362
+ (`diegoos/agent-memory#${VERSION}`, no `v` prefix); not the npm tarball path.
363
+ - safe: Interactive menu resilience — EOF handler, CSI/ESC parsing, Alt+letter,
364
+ `try/finally` raw-mode cleanup; `run()` fails on child signal/null status;
365
+ `shell: false` after options spread.
366
+ - safe: Cross-package docs / vendor skeleton pin `hooks/README.md` and examples to
367
+ `0.0.13` (blob / github / skills add).
368
+ - safe: `skills/agent-memory/SKILL.md` — version bumped to `0.0.13`.
369
+ - safe: root `package.json` — version bumped to `0.0.13`.
@@ -0,0 +1,33 @@
1
+ # Active Work — Branch: `<branch>`
2
+
3
+ Ephemeral, per-branch scratchpad. On your first task on a branch, copy this file
4
+ to `active-work/<branch>.md` (sanitize the branch name: every character that is
5
+ not a letter, digit, `.`, `_`, or `-` becomes `-`) and set the `Branch:` header
6
+ above to the real branch name. Delete your file when the branch merges.
7
+
8
+ ## Task
9
+
10
+ **Required.** Hooks seed a stub from the branch name when this is still a
11
+ placeholder; refine from `current.md`, `log.md`, and the user's request — one or
12
+ two concise lines. Semantic task text is your responsibility.
13
+
14
+ - _No active task._
15
+
16
+ ## Progress
17
+
18
+ - _none_
19
+
20
+ ## Touched files
21
+
22
+ Hooks refresh this section from `git` between turns. You may add notes in
23
+ _Progress_ or _Notes_ for files that matter semantically.
24
+
25
+ - _none_
26
+
27
+ ## Blockers
28
+
29
+ - _none_
30
+
31
+ ## Notes
32
+
33
+ - _none_
@@ -0,0 +1,34 @@
1
+ # Current State
2
+
3
+ Shared, durable snapshot of the project. Update when project state changes — as
4
+ part of the PR that lands the change, or at checkpoints via
5
+ `/agent-memory sync`. Keep it short; detail belongs in `log.md`, `decisions.md`,
6
+ or lazy files.
7
+
8
+ ## Version / milestone
9
+
10
+ _e.g. v0.1 — initial setup._
11
+
12
+ ## Done
13
+
14
+ Completed capabilities or merged work. When an `active-work/<branch>.md` file is
15
+ finished and removed (branch merged), move a one-line summary here with branch
16
+ name, example: `- feat/login — implemented login functionality`.
17
+
18
+ - _Completed capability_
19
+
20
+ ## In progress
21
+
22
+ High-level work underway — **not** step-by-step detail (that lives in
23
+ `active-work/<branch>.md`). Hooks refresh this list on session start from open
24
+ active-work files; you refine summaries when branch goals change:
25
+
26
+ - [`active-work/<branch>.md`](./active-work/) — _branch goal in one line._
27
+
28
+ ## Next steps
29
+
30
+ **Only when an explicit roadmap or plan exists** in the project docs or the user
31
+ recorded one. Do **not** infer or invent next steps. Remove this section (or
32
+ leave the placeholder) when there is no agreed plan.
33
+
34
+ - _Upcoming milestones from an explicit plan._
@@ -0,0 +1,30 @@
1
+ # Decisions
2
+
3
+ Important architecture and design decisions with reasoning. Oldest first —
4
+ append new entries at the **bottom**. On merge conflicts, keep both.
5
+
6
+ **You MUST record decisions here** when you make, confirm, or **change** a
7
+ non-trivial choice (library, pattern, API shape, data model, security trade-off,
8
+ etc.). When superseding a prior decision, add a new entry that references it.
9
+
10
+ ## When to record
11
+
12
+ - Choosing between viable approaches (and why the others were rejected).
13
+ - Adopting or changing a convention that affects more than one file.
14
+ - Any decision a future agent would need to avoid re-litigating.
15
+
16
+ Skip: trivial renames, obvious bug fixes, formatting-only changes.
17
+
18
+ ## Format (concise ADR)
19
+
20
+ ```md
21
+ ## [YYYY-MM-DD] Short title
22
+
23
+ **Context:** what problem or choice prompted this. **Decision:** what was
24
+ decided. **Why:** reasoning and alternatives considered. **Consequences:**
25
+ follow-ups, constraints, or files affected (optional).
26
+ ```
27
+
28
+ ---
29
+
30
+ _No decisions recorded yet._
@@ -0,0 +1,55 @@
1
+ # Memory Index
2
+
3
+ Map and entry point. Read this, `current.md`, and your branch's active-work file
4
+ before any task; see `instructions.md` for the full method.
5
+
6
+ **Keep this file aligned** with the memory tree: every lazy file and every
7
+ `domains/*.md` / `features/*.md` entry must be linked here; remove links when
8
+ files are deleted. `index.md` is updated at checkpoints and by
9
+ `/agent-memory sync` (domains/features discovery) — you must also update it when
10
+ you create or rename lazy files by hand.
11
+
12
+ ## Loading policy
13
+
14
+ - **Always load** (before any task): this `index.md`, `current.md`, and your
15
+ branch's `active-work/<branch>.md`. (`instructions.md` is attached via your
16
+ agent file.) That is the minimal context.
17
+ - **Load on demand**: everything else — including `decisions.md` and `log.md` —
18
+ when the task needs it. Use the lists below to find it.
19
+
20
+ ## Core files
21
+
22
+ - [instructions.md](./instructions.md) — the method.
23
+ - [current.md](./current.md) — shared project state.
24
+ - `active-work/` — per-branch scratchpad (see `instructions.md` → _Per-branch
25
+ active work_).
26
+ - [decisions.md](./decisions.md) — decisions + reasoning.
27
+ - [log.md](./log.md) — chronological activity (per-session headings + bullets).
28
+
29
+ ## Lazy files (created on demand; link them here once real)
30
+
31
+ | File | Purpose |
32
+ | ------------------------------------ | ------------------------------------------------------------- |
33
+ | [vision.md](./vision.md) | Product purpose, scope, goals — ask the user if uncertain. |
34
+ | [architecture.md](./architecture.md) | Components, stack, major flows — update on structural change. |
35
+ | [patterns.md](./patterns.md) | Coding conventions — align with agent instruction files. |
36
+ | [mistakes.md](./mistakes.md) | Pitfalls to avoid. |
37
+ | [known-issues.md](./known-issues.md) | Bugs, limitations, debt. |
38
+
39
+ Also `domains/*.md` and `features/*.md` — one file per major area or user-facing
40
+ capability; link under _Domains_ / _Features_ below.
41
+
42
+ ## Domains
43
+
44
+ Technical or structural areas (backend, API, infra, packages). Add a link when
45
+ you create `domains/<name>.md`; remove when the file is deleted.
46
+
47
+ _None yet._
48
+
49
+ ## Features
50
+
51
+ User-facing or product capabilities. Add a link when you create
52
+ `features/<name>.md`; remove when the file is deleted. If the project has no
53
+ feature-level docs, leave this section as _None yet._
54
+
55
+ _None yet._