memhook 0.2.2 → 0.4.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.
- package/CHANGELOG.md +30 -72
- package/README.md +158 -69
- package/dist/bin/memhook.d.ts +11 -6
- package/dist/bin/memhook.d.ts.map +1 -1
- package/dist/bin/memhook.js +208 -21
- package/dist/bin/memhook.js.map +1 -1
- package/dist/src/ansi.d.ts +71 -0
- package/dist/src/ansi.d.ts.map +1 -0
- package/dist/src/ansi.js +100 -0
- package/dist/src/ansi.js.map +1 -0
- package/dist/src/backup.d.ts +10 -0
- package/dist/src/backup.d.ts.map +1 -0
- package/dist/src/backup.js +17 -0
- package/dist/src/backup.js.map +1 -0
- package/dist/src/cache.d.ts.map +1 -1
- package/dist/src/cache.js +14 -7
- package/dist/src/cache.js.map +1 -1
- package/dist/src/config.d.ts +11 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +6 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/configFile.d.ts +6 -0
- package/dist/src/configFile.d.ts.map +1 -1
- package/dist/src/configFile.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/init.d.ts +48 -0
- package/dist/src/init.d.ts.map +1 -0
- package/dist/src/init.js +327 -0
- package/dist/src/init.js.map +1 -0
- package/dist/src/install.d.ts +87 -0
- package/dist/src/install.d.ts.map +1 -0
- package/dist/src/install.js +124 -0
- package/dist/src/install.js.map +1 -0
- package/dist/src/router.d.ts +22 -0
- package/dist/src/router.d.ts.map +1 -1
- package/dist/src/router.js +113 -8
- package/dist/src/router.js.map +1 -1
- package/dist/src/skills.d.ts +68 -0
- package/dist/src/skills.d.ts.map +1 -0
- package/dist/src/skills.js +73 -0
- package/dist/src/skills.js.map +1 -0
- package/dist/src/skillsCmd.d.ts +51 -0
- package/dist/src/skillsCmd.d.ts.map +1 -0
- package/dist/src/skillsCmd.js +273 -0
- package/dist/src/skillsCmd.js.map +1 -0
- package/dist/src/tail.d.ts +76 -0
- package/dist/src/tail.d.ts.map +1 -0
- package/dist/src/tail.js +280 -0
- package/dist/src/tail.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +9 -2
- package/skills/curate/SKILL.md +181 -0
- package/skills/curate/reference.md +105 -0
- package/skills/relay/SKILL.md +162 -0
- package/skills/wrap/SKILL.md +173 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wrap
|
|
3
|
+
description: End-of-session wrap-up for Claude Code. Detects what changed during the session (git commits, working-tree edits, new/edited memory & rule files) and proposes structured updates to your memory directory, MEMORY.md index, and a dated journal entry. Proposes only — never writes without your approval. Invoke at the end of a work session, when you say "wrap up", "end session", or "/wrap".
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
allowed-tools: Read Glob Grep Bash Edit Write
|
|
6
|
+
argument-hint: [optional one-line note about the session]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /wrap — end-of-session wrap-up
|
|
10
|
+
|
|
11
|
+
A companion skill for [memhook](https://github.com/utilia-ai-wox/memhook).
|
|
12
|
+
memhook routes your `feedback_*.md` / `project_*.md` / `rule_*.md` files into
|
|
13
|
+
each prompt; this skill keeps that memory current. Run it at the end of a
|
|
14
|
+
session so the lessons of the session are captured before the context is gone.
|
|
15
|
+
|
|
16
|
+
## Objective
|
|
17
|
+
|
|
18
|
+
Close the session loop: collect what changed (commits, working-tree edits,
|
|
19
|
+
detected lessons), propose a set of structured updates to **your memory
|
|
20
|
+
system** (memory files, `MEMORY.md` index, a dated journal entry), and let
|
|
21
|
+
**you** approve each one before anything is written.
|
|
22
|
+
|
|
23
|
+
## Cardinal constraint — nothing is written without approval
|
|
24
|
+
|
|
25
|
+
**No file is modified before explicit user approval.** The skill produces a
|
|
26
|
+
report and a plan; you approve, reject, or amend each proposal. It is
|
|
27
|
+
idempotent: running it again after a session is already wrapped should produce
|
|
28
|
+
an empty or minimal report.
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
This skill touches **memory + doctrine + journal** only. It never edits your
|
|
33
|
+
application code (`src/`, `apps/`, `packages/`, tests).
|
|
34
|
+
|
|
35
|
+
| Category | Path | What to detect |
|
|
36
|
+
| ------------- | ---------------------------------------------- | ----------------------------------------------------------- |
|
|
37
|
+
| Memory | `~/.claude/projects/<project>/memory/*.md` | New lessons to capture; `MEMORY.md` index drift |
|
|
38
|
+
| Global rules | `~/.claude/rules/*.md` | A rule edited this session; an anti-pattern worth recording |
|
|
39
|
+
| Project rules | `<repo>/.claude/rules/*.md` | Same, scoped to the current repo |
|
|
40
|
+
| Journal | `~/.claude/projects/<project>/memory/journal/` | Today's journal entry missing after a real session |
|
|
41
|
+
| Skills | `~/.claude/skills/*/SKILL.md` | A repeated pattern worth formalising into a skill |
|
|
42
|
+
|
|
43
|
+
The `<project>` directory is the sanitised form of the current working
|
|
44
|
+
directory used by Claude Code (e.g. `/Users/me/dev/app` →
|
|
45
|
+
`-Users-me-dev-app`). When unsure, glob `~/.claude/projects/*/memory/` and pick
|
|
46
|
+
the one matching the cwd.
|
|
47
|
+
|
|
48
|
+
## Workflow
|
|
49
|
+
|
|
50
|
+
### Phase 1 — capture session state
|
|
51
|
+
|
|
52
|
+
1. **Estimate session start.** Heuristic: the oldest mtime among files touched
|
|
53
|
+
under `.claude/` this session, or fall back to the last few hours.
|
|
54
|
+
|
|
55
|
+
2. **List commits made during the session** in the current repo:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
git -C "$(pwd)" log --since="<session_start>" --oneline
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
3. **List changed / created files:**
|
|
62
|
+
- `git -C "$(pwd)" status --short` (uncommitted)
|
|
63
|
+
- `git -C "$(pwd)" log --name-only --since="<session_start>"` (committed)
|
|
64
|
+
- `find ~/.claude/rules ~/.claude/skills -newer <marker>` (global doctrine)
|
|
65
|
+
- `find ~/.claude/projects/<project>/memory -maxdepth 1 -name '*.md' -newer <marker>` (memory)
|
|
66
|
+
|
|
67
|
+
4. **Cross-reference each change** to a cause: which decision motivated a rule
|
|
68
|
+
edit? Which lesson does a new memory capture? A correction repeated 3+ times
|
|
69
|
+
is a candidate anti-pattern worth formalising.
|
|
70
|
+
|
|
71
|
+
### Phase 2 — detect weak signals
|
|
72
|
+
|
|
73
|
+
For each category, ask what _should_ be recorded but isn't:
|
|
74
|
+
|
|
75
|
+
| Signal | Proposed action |
|
|
76
|
+
| ---------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
77
|
+
| A technical decision made in conversation with no trace | Propose a `project_*.md` memory |
|
|
78
|
+
| A user preference expressed ("stop doing X") with no trace | Propose a `feedback_*.md` memory |
|
|
79
|
+
| A correction repeated 3+ times | Propose an anti-pattern note in the relevant rule |
|
|
80
|
+
| A rule mentions something the code no longer contains | Propose trimming the stale mention (verify with Grep first) |
|
|
81
|
+
| Today's journal entry missing after a real session | Propose `journal/YYYY-MM-DD.md` (Decided / Learned / Blocked, ≤ 50 ln) |
|
|
82
|
+
|
|
83
|
+
### Phase 3 — structured report
|
|
84
|
+
|
|
85
|
+
Present a single report:
|
|
86
|
+
|
|
87
|
+
````markdown
|
|
88
|
+
## Session wrap — YYYY-MM-DD HH:MM (duration ~Xh)
|
|
89
|
+
|
|
90
|
+
### Activity
|
|
91
|
+
|
|
92
|
+
- Commits: N in <repo>
|
|
93
|
+
- System files touched: P rules, Q memory, R skills
|
|
94
|
+
- Note: "<optional argument>"
|
|
95
|
+
|
|
96
|
+
### Signals detected (N proposals)
|
|
97
|
+
|
|
98
|
+
1. **[CATEGORY]** what was detected
|
|
99
|
+
- Source: <file:line or commit hash>
|
|
100
|
+
- Action: create / edit / delete
|
|
101
|
+
- Target: <path>
|
|
102
|
+
- Diff:
|
|
103
|
+
```diff
|
|
104
|
+
- <old>
|
|
105
|
+
+ <new>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Approval
|
|
109
|
+
|
|
110
|
+
- "ok 1, 2, 5" → apply 1, 2, 5
|
|
111
|
+
- "ok all" → apply everything
|
|
112
|
+
- "skip 3" → leave it out
|
|
113
|
+
- "change X…" → adjust before applying
|
|
114
|
+
````
|
|
115
|
+
|
|
116
|
+
### Phase 4 — apply approved changes
|
|
117
|
+
|
|
118
|
+
For each approved proposal:
|
|
119
|
+
|
|
120
|
+
- Read the target (when editing), then Edit / Write the exact approved diff.
|
|
121
|
+
- A new memory file **must keep a one-line `description:` in its frontmatter**
|
|
122
|
+
— memhook's catalog and router read that line to decide relevance, so an
|
|
123
|
+
empty or missing description makes the memory invisible to routing.
|
|
124
|
+
- A journal entry uses three fixed sections (Decided / Learned / Blocked),
|
|
125
|
+
capped at ~50 lines.
|
|
126
|
+
- **After any memory create / edit / delete, rebuild the catalog** so memhook
|
|
127
|
+
routes against the new state:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
memhook build-catalog
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- Add the new memory to the `MEMORY.md` index (one line: `- [Title](file.md)`).
|
|
134
|
+
- **Never commit automatically** — the user keeps control of the git message and scope.
|
|
135
|
+
|
|
136
|
+
### Phase 5 — recap
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
## Applied
|
|
140
|
+
|
|
141
|
+
- ✅ memory/feedback_x.md created (+ MEMORY.md index + catalog rebuilt)
|
|
142
|
+
- ✅ ~/.claude/rules/y.md: stale mention removed
|
|
143
|
+
- ✅ journal/2026-06-02.md created
|
|
144
|
+
|
|
145
|
+
## To commit (your call)
|
|
146
|
+
|
|
147
|
+
git add … && git commit -m "…"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Rules
|
|
151
|
+
|
|
152
|
+
- **Explicit approval required** — `/wrap` writes nothing without confirmation.
|
|
153
|
+
- **Idempotent** — re-running after a wrapped session yields an empty report.
|
|
154
|
+
- **Cap the report at ~200 lines** — if there are > 10 proposals, batch and
|
|
155
|
+
prioritise (high / medium / low).
|
|
156
|
+
- **Source every signal** on a real `file:line` or commit hash — never invent one.
|
|
157
|
+
- **Preserve `description:`** on every memory file (load-bearing for memhook).
|
|
158
|
+
- **Rebuild the catalog** (`memhook build-catalog`) after memory changes.
|
|
159
|
+
- **No automatic commits** — leave the final git decision to the user.
|
|
160
|
+
|
|
161
|
+
## Anti-patterns
|
|
162
|
+
|
|
163
|
+
- Writing to the memory system without approval.
|
|
164
|
+
- Proposing 30 trivial edits instead of a prioritised handful.
|
|
165
|
+
- Inventing a signal with no verifiable source.
|
|
166
|
+
- Editing application code (out of scope).
|
|
167
|
+
- Forgetting the catalog rebuild after deleting or merging a memory.
|
|
168
|
+
|
|
169
|
+
## Related skills
|
|
170
|
+
|
|
171
|
+
- `/curate` — periodic memory hygiene (dedupe, stale, index sync). Chains well
|
|
172
|
+
after `/wrap`.
|
|
173
|
+
- `/relay` — generate a handoff prompt to continue in a fresh session.
|