memindex 1.4.5 → 1.5.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.qoder-plugin/plugin.json +1 -1
- package/README.md +8 -2
- package/dist/bug-report/index.js +94 -83
- package/dist/npx-cli/index.js +300 -299
- package/dist/opencode-plugin/index.js +40 -40
- package/dist/pi-extension/TYPEBOX-PROVENANCE.json +4 -4
- package/dist/pi-extension/index.js +9 -9
- package/integrations/dsh/lib/index.js +19 -19
- package/integrations/dsh/package.json +1 -1
- package/integrations/openclaw/install.sh +16 -10
- package/integrations/openclaw/openclaw.plugin.json +1 -5
- package/integrations/openclaw/test-install.sh +20 -13
- package/integrations/pi/TYPEBOX-PROVENANCE.json +4 -4
- package/package.json +5 -5
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.qoder-plugin/plugin.json +1 -1
- package/plugin/hooks/codex-hooks.json +12 -0
- package/plugin/package.json +1 -1
- package/plugin/scripts/context-generator.cjs +65 -63
- package/plugin/scripts/context-generator.cjs.map +3 -3
- package/plugin/scripts/mcp-server.cjs +71 -70
- package/plugin/scripts/mcp-server.cjs.map +3 -3
- package/plugin/scripts/statusline.cjs +1 -1
- package/plugin/scripts/transcript-watcher.cjs +36 -35
- package/plugin/scripts/transcript-watcher.cjs.map +3 -3
- package/plugin/scripts/worker-service.cjs +714 -674
- package/plugin/scripts/worker-service.cjs.map +3 -3
- package/plugin/skills/cloud-sync/SKILL.md +5 -5
- package/plugin/skills/distill/SKILL.md +22 -0
- package/plugin/skills/how-it-works/SKILL.md +1 -1
- package/plugin/skills/how-it-works/onboarding-explainer.md +1 -1
- package/plugin/skills/import-chats/SKILL.md +22 -0
- package/plugin/skills/import-jira/SKILL.md +22 -0
- package/plugin/skills/import-reviews/SKILL.md +22 -0
- package/plugin/skills/mode-creator/SKILL.md +7 -1
- package/plugin/skills/pin/SKILL.md +26 -0
- package/plugin/skills/savings/SKILL.md +22 -0
- package/plugin/skills/timeline-report/SKILL.md +8 -8
- package/plugin/skills/weekly-digests/SKILL.md +5 -5
- package/plugin/skills/worker-request.mjs +45 -0
- package/plugin/sqlite/SessionStore.js +109 -109
- package/plugin/sqlite/SessionStore.js.map +3 -3
- package/plugin/sqlite/observations/files.js +12 -9
- package/plugin/sqlite/observations/files.js.map +3 -3
- package/plugin/ui/viewer-bundle.js +18 -18
- package/integrations/openclaw/skills/agent-cost-report/CHECKSUMS.txt +0 -50
- package/integrations/openclaw/skills/agent-cost-report/SKILL.md +0 -241
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/__init__.py +0 -1
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/behavior.py +0 -303
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/classify.py +0 -83
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/costs.py +0 -119
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/devices.py +0 -88
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/evidence.py +0 -160
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/labels.py +0 -115
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/measure.py +0 -89
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/mistakes.py +0 -310
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/patterns.py +0 -391
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/period.py +0 -98
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/prices.py +0 -95
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/render.py +0 -586
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rollup.py +0 -355
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rules.json +0 -4
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/rules.py +0 -76
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/sample.py +0 -45
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/snapshot.py +0 -53
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/sync.py +0 -79
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/transcripts.py +0 -126
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr/wins.py +0 -341
- package/integrations/openclaw/skills/agent-cost-report/scripts/acr.py +0 -219
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/_db.py +0 -49
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/_paths.py +0 -9
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/codex/sessions/2026/09/18/rollout-codex-1.jsonl +0 -4
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/make_report_fixtures.py +0 -46
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/prices_sample.json +0 -6
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-a/sess-aaaa.jsonl +0 -8
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-b/sess-bbbb.jsonl +0 -1
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-1day.json +0 -823
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-30day.json +0 -2213
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-7day.json +0 -1252
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-empty.json +0 -536
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/fixtures/report-session.json +0 -662
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_behavior.py +0 -299
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_devices.py +0 -99
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_labels.py +0 -96
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_measure.py +0 -120
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_pdf_windows.py +0 -54
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_period.py +0 -137
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_prices.py +0 -126
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_render.py +0 -238
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_render_encoding.py +0 -70
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_rollup.py +0 -263
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_snapshot.py +0 -63
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_sync.py +0 -52
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_transcript_encoding.py +0 -109
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_transcripts.py +0 -151
- package/integrations/openclaw/skills/agent-cost-report/scripts/tests/test_wins.py +0 -222
- package/plugin/skills/agent-cost-report/CHECKSUMS.txt +0 -50
- package/plugin/skills/agent-cost-report/SKILL.md +0 -241
- package/plugin/skills/agent-cost-report/scripts/acr/__init__.py +0 -1
- package/plugin/skills/agent-cost-report/scripts/acr/behavior.py +0 -303
- package/plugin/skills/agent-cost-report/scripts/acr/classify.py +0 -83
- package/plugin/skills/agent-cost-report/scripts/acr/costs.py +0 -119
- package/plugin/skills/agent-cost-report/scripts/acr/devices.py +0 -88
- package/plugin/skills/agent-cost-report/scripts/acr/evidence.py +0 -160
- package/plugin/skills/agent-cost-report/scripts/acr/labels.py +0 -115
- package/plugin/skills/agent-cost-report/scripts/acr/measure.py +0 -89
- package/plugin/skills/agent-cost-report/scripts/acr/mistakes.py +0 -310
- package/plugin/skills/agent-cost-report/scripts/acr/patterns.py +0 -391
- package/plugin/skills/agent-cost-report/scripts/acr/period.py +0 -98
- package/plugin/skills/agent-cost-report/scripts/acr/prices.py +0 -95
- package/plugin/skills/agent-cost-report/scripts/acr/render.py +0 -586
- package/plugin/skills/agent-cost-report/scripts/acr/rollup.py +0 -355
- package/plugin/skills/agent-cost-report/scripts/acr/rules.json +0 -4
- package/plugin/skills/agent-cost-report/scripts/acr/rules.py +0 -76
- package/plugin/skills/agent-cost-report/scripts/acr/sample.py +0 -45
- package/plugin/skills/agent-cost-report/scripts/acr/snapshot.py +0 -53
- package/plugin/skills/agent-cost-report/scripts/acr/sync.py +0 -79
- package/plugin/skills/agent-cost-report/scripts/acr/transcripts.py +0 -126
- package/plugin/skills/agent-cost-report/scripts/acr/wins.py +0 -341
- package/plugin/skills/agent-cost-report/scripts/acr.py +0 -219
- package/plugin/skills/agent-cost-report/scripts/tests/_db.py +0 -49
- package/plugin/skills/agent-cost-report/scripts/tests/_paths.py +0 -9
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/codex/sessions/2026/09/18/rollout-codex-1.jsonl +0 -4
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/make_report_fixtures.py +0 -46
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/prices_sample.json +0 -6
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-a/sess-aaaa.jsonl +0 -8
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/projects/-workspace-proj-b/sess-bbbb.jsonl +0 -1
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-1day.json +0 -823
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-30day.json +0 -2213
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-7day.json +0 -1252
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-empty.json +0 -536
- package/plugin/skills/agent-cost-report/scripts/tests/fixtures/report-session.json +0 -662
- package/plugin/skills/agent-cost-report/scripts/tests/test_behavior.py +0 -299
- package/plugin/skills/agent-cost-report/scripts/tests/test_devices.py +0 -99
- package/plugin/skills/agent-cost-report/scripts/tests/test_labels.py +0 -96
- package/plugin/skills/agent-cost-report/scripts/tests/test_measure.py +0 -120
- package/plugin/skills/agent-cost-report/scripts/tests/test_pdf_windows.py +0 -54
- package/plugin/skills/agent-cost-report/scripts/tests/test_period.py +0 -137
- package/plugin/skills/agent-cost-report/scripts/tests/test_prices.py +0 -126
- package/plugin/skills/agent-cost-report/scripts/tests/test_render.py +0 -238
- package/plugin/skills/agent-cost-report/scripts/tests/test_render_encoding.py +0 -70
- package/plugin/skills/agent-cost-report/scripts/tests/test_rollup.py +0 -263
- package/plugin/skills/agent-cost-report/scripts/tests/test_snapshot.py +0 -63
- package/plugin/skills/agent-cost-report/scripts/tests/test_sync.py +0 -52
- package/plugin/skills/agent-cost-report/scripts/tests/test_transcript_encoding.py +0 -109
- package/plugin/skills/agent-cost-report/scripts/tests/test_transcripts.py +0 -151
- package/plugin/skills/agent-cost-report/scripts/tests/test_wins.py +0 -222
- package/plugin/skills/babysit/SKILL.md +0 -87
- package/plugin/skills/design-is/SKILL.md +0 -312
- package/plugin/skills/do/SKILL.md +0 -45
- package/plugin/skills/learn-codebase/SKILL.md +0 -21
- package/plugin/skills/make-plan/SKILL.md +0 -67
- package/plugin/skills/oh-my-issues/SKILL.md +0 -226
- package/plugin/skills/pathfinder/SKILL.md +0 -111
- package/plugin/skills/screenpipe/SKILL.md +0 -78
- package/plugin/skills/screenpipe/screenpipe.mjs +0 -196
- package/plugin/skills/smart-explore/SKILL.md +0 -193
- package/plugin/skills/standup/SKILL.md +0 -142
- package/plugin/skills/standup/agent-brief.md +0 -47
- package/plugin/skills/standup/standup.mjs +0 -586
- package/plugin/skills/what-the/SKILL.md +0 -6
- package/plugin/skills/wowerpoint/SKILL.md +0 -205
|
@@ -34,10 +34,10 @@ Resolve the worker port and query the always-registered status route:
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
PORT="${MEMINDEX_WORKER_PORT:-$(node -e "const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(38700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.memindex','settings.json'),'utf-8'));process.stdout.write(String(s.MEMINDEX_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}" 2>/dev/null)}"
|
|
37
|
-
#
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
memcurl
|
|
37
|
+
# Set MEMINDEX_SKILL_DIR to the absolute directory containing this SKILL.md.
|
|
38
|
+
# The helper checks the worker's identity before sending the install secret.
|
|
39
|
+
memcurl() { node "${MEMINDEX_SKILL_DIR:?Set the installed skill directory}/../worker-request.mjs" "$@"; }
|
|
40
|
+
memcurl "http://127.0.0.1:${PORT}/api/sync/status"
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
- `configured: true` and `hub.reachable: true` → the worker completed an
|
|
@@ -72,7 +72,7 @@ Once the settings are saved, poll the status route every five seconds for up to
|
|
|
72
72
|
30 seconds. If the worker was not restarted, restart it first:
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
memcurl
|
|
75
|
+
memcurl "http://127.0.0.1:${PORT}/api/admin/restart" POST
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
Success means `configured: true`, `hub.reachable: true`, and `lastError: null`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: distill
|
|
3
|
+
description: Use when the user says "distill my memory", "turn my notes into rules", or wants CLAUDE.md rules from recurring decisions, fixes and procedures.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Distill memory into rules
|
|
7
|
+
|
|
8
|
+
Run from the intended repository to propose rules and procedure skills from recurring notes. Preview first; this command writes nothing and has no `--dry-run` flag:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npx memindex distill
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Show the numbered proposals, their source note IDs and the files each would change. Rules go into `CLAUDE.md` and an existing `AGENTS.md`; procedure skills go under `.claude/skills/`. Nothing is written until the user picks proposals.
|
|
15
|
+
|
|
16
|
+
Apply only the picked numbers. For item 1:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx memindex distill --apply --only 1
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Replace `1` with the selected numbers, comma-separated. Keep any `--project NAME` or `--min-notes N` options identical to the preview. Report the actual file changes and any skipped proposals.
|
|
@@ -13,7 +13,7 @@ Every Read, Edit, and Bash that Claude makes turns into a compressed observation
|
|
|
13
13
|
|
|
14
14
|
Memory injection starts on your second session in a project.
|
|
15
15
|
|
|
16
|
-
The first session in a fresh project seeds memory; subsequent sessions receive auto-injected context for relevant past work.
|
|
16
|
+
The first session in a fresh project seeds memory; subsequent sessions receive auto-injected context for relevant past work.
|
|
17
17
|
|
|
18
18
|
## Where data lives
|
|
19
19
|
|
|
@@ -8,7 +8,7 @@ Every Read, Edit, and Bash that Claude makes turns into a compressed observation
|
|
|
8
8
|
|
|
9
9
|
Memory injection starts on your second session in a project.
|
|
10
10
|
|
|
11
|
-
The first session in a fresh project seeds memory; subsequent sessions receive auto-injected context for relevant past work.
|
|
11
|
+
The first session in a fresh project seeds memory; subsequent sessions receive auto-injected context for relevant past work.
|
|
12
12
|
|
|
13
13
|
## Where data lives
|
|
14
14
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: import-chats
|
|
3
|
+
description: Use when the user says "import my chats", "bring in my Codex conversations", or wants saved Gemini or Claude Code chats remembered by MemIndex.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Import saved chats
|
|
7
|
+
|
|
8
|
+
Use this for another coding agent's saved chats. Choose `codex`, `gemini` or `claude-code` for `--from`; the example uses Codex.
|
|
9
|
+
|
|
10
|
+
Always preview first:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx memindex import chats --from codex --dry-run
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Show the source folder, chats with new work, event counts, note writer and estimated cost. If cost is unavailable, say so. Nothing is sent in the dry run. Wait for the user to say yes to the import and cost, then repeat without `--dry-run`:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx memindex import chats --from codex
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Keep the same source and any chosen `--dir "folder"`, `--since "ISO time"` and `--until "ISO time"` filters. There is no `--yes` flag. Report what was sent and skipped; the note writer processes imported activity in the background.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: import-jira
|
|
3
|
+
description: Use when the user says "import my Jira", "bring Jira tickets into memory", or wants MemIndex to remember a Jira project's tickets.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Import Jira tickets
|
|
7
|
+
|
|
8
|
+
Use this to bring Jira tickets into memory. Ask for the project key if it is missing; replace KEY below with that key.
|
|
9
|
+
|
|
10
|
+
Always preview first:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx memindex import jira --project KEY --dry-run
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Show the ticket counts (new, changed and unchanged), notes to write, sample note, destination and cost or hosting allowance. Wait for the user to say yes, then run:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx memindex import jira --project KEY --yes
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If the user chose `--limit N`, `--since YYYY-MM-DD` or `--jql "..."`, keep those exact filters in both runs. Use the configured Jira login; never print its token. Report saved, pending and failed counts.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: import-reviews
|
|
3
|
+
description: Use when the user says "import my reviews", "remember PR review rulings", or wants settled GitHub pull request review decisions in memory.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Import review rulings
|
|
7
|
+
|
|
8
|
+
Use this for settled GitHub PR review threads. Replace owner/name with the requested repository.
|
|
9
|
+
|
|
10
|
+
Always preview first:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx memindex import reviews --repo owner/name --dry-run
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Show the new, changed and unchanged rulings, notes to write, sample ruling, project, destination and cost or hosting allowance. Wait for the user to say yes, then run:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx memindex import reviews --repo owner/name --yes
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Keep any chosen `--limit N`, `--since YYYY-MM-DD` and `--project NAME` filters identical in both runs. Use the existing GitHub login without printing its token. Report saved, pending and failed counts; zero settled threads is a valid result.
|
|
@@ -105,9 +105,15 @@ Verify all of the following:
|
|
|
105
105
|
1. Restart reports a new healthy worker and exits successfully.
|
|
106
106
|
2. The installed file exists under the resolved data directory.
|
|
107
107
|
3. `settings.json` names the intended `MEMINDEX_MODE` without displaying secrets.
|
|
108
|
-
4. Request full startup context with the `session_start_context` MCP tool when available. Otherwise
|
|
108
|
+
4. Request full startup context with the `session_start_context` MCP tool when available. Otherwise use the helper below with the configured worker port. It checks the listener's identity before sending the install secret.
|
|
109
109
|
5. Startup context contains `Mode: <mode name> (<mode id>)`.
|
|
110
110
|
|
|
111
|
+
```bash
|
|
112
|
+
# Set MEMINDEX_SKILL_DIR to the absolute directory containing this SKILL.md.
|
|
113
|
+
memcurl() { node "${MEMINDEX_SKILL_DIR:?Set the installed skill directory}/../worker-request.mjs" "$@"; }
|
|
114
|
+
memcurl "http://127.0.0.1:${MEMINDEX_WORKER_PORT:?Set the configured worker port}/api/context/inject?project=mode-creator-verification&full=true"
|
|
115
|
+
```
|
|
116
|
+
|
|
111
117
|
If the worker falls back to `code`, inspect the worker log for a mode validation or lookup error, repair the mode, and repeat the restart. Do not describe a fallback as successful activation.
|
|
112
118
|
|
|
113
119
|
## 6. Hand off clearly
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pin
|
|
3
|
+
description: Use when the user says "pin this note", "keep this decision at session start", "unpin this", or wants a memory note first on the current branch.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pin or unpin a note
|
|
7
|
+
|
|
8
|
+
Use this to keep a note at the top of session start on the current branch. Resolve the note's numeric ID from search or the session-start panel; ask if the note is ambiguous. Show its ID, text, current branch and short reason before changing it. There is no dry run.
|
|
9
|
+
|
|
10
|
+
Prefer the MCP tools. Replace 123 and the reason with the chosen note and reason:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
pin_memory({"id": 123, "why": "Keep this decision visible"})
|
|
14
|
+
unpin_memory({"id": 123})
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Call only the tool the user requested. Omitting branch and projectWide scopes the change to the current branch. Pins become project-wide when that branch merges.
|
|
18
|
+
|
|
19
|
+
If the tools are unavailable, run from the intended checkout:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npx memindex pin 123 --why "Keep this decision visible"
|
|
23
|
+
npx memindex unpin 123
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Report whether the pin was added, already present or removed. If the current branch cannot be identified, ask which branch before changing a pin.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: savings
|
|
3
|
+
description: Use when the user asks "what did memory save me", "show my token savings", or how many tokens and dollars MemIndex saved by project or day.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Show memory savings
|
|
7
|
+
|
|
8
|
+
Show tokens and estimated dollars saved, with daily and project totals. State the period and project scope before running. These commands are read-only and have no dry-run flag.
|
|
9
|
+
|
|
10
|
+
For all projects over seven days:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx memindex savings --days 7
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For the current project:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx memindex savings --days 7 --here
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use the requested day count. For a named project, use `--project "NAME"` instead of `--here`; add `--json` if structured output helps. Show totals, the day and project rows, unmeasured notes and the report's calculation explanation. Label dollars as an estimate, not a bill or a measured reduction in spending.
|
|
@@ -26,9 +26,9 @@ The memindex worker must be running. The project must have memindex observations
|
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
WORKER_PORT="${MEMINDEX_WORKER_PORT:-$(node -e "const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(38700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.memindex','settings.json'),'utf-8'));process.stdout.write(String(s.MEMINDEX_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}" 2>/dev/null)}"
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
# Set MEMINDEX_SKILL_DIR to the absolute directory containing this SKILL.md.
|
|
30
|
+
# The helper checks the worker's identity before sending the install secret.
|
|
31
|
+
memcurl() { node "${MEMINDEX_SKILL_DIR:?Set the installed skill directory}/../worker-request.mjs" "$@"; }
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
This honors `MEMINDEX_WORKER_PORT` env, then `~/.memindex/settings.json`, then falls back to the per-UID default `38700 + (uid % 100)` — matching how the worker itself picks its port. Required for multi-account setups (#2101) and any user who has overridden the default port (#2103).
|
|
@@ -61,7 +61,7 @@ If a worktree is detected, use `$parent_project` (the basename of the parent rep
|
|
|
61
61
|
Use Bash to fetch the complete timeline from the memindex worker API:
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
|
-
memcurl
|
|
64
|
+
memcurl "http://localhost:${WORKER_PORT}/api/context/inject?project=PROJECT_NAME&full=true"
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
This returns the entire compressed timeline -- every observation, session boundary, and summary across the project's full history. The response is pre-formatted markdown optimized for LLM consumption.
|
|
@@ -71,7 +71,7 @@ This returns the entire compressed timeline -- every observation, session bounda
|
|
|
71
71
|
- Medium project (1,000-10,000 observations): ~50-300K tokens
|
|
72
72
|
- Large project (10,000-35,000 observations): ~300-750K tokens
|
|
73
73
|
|
|
74
|
-
If the response is empty or returns an error, the worker may not be running or the project name may be wrong. Try `memcurl
|
|
74
|
+
If the response is empty or returns an error, the worker may not be running or the project name may be wrong. Try `memcurl "http://localhost:${WORKER_PORT}/api/search?query=*&limit=1"` to verify the worker is healthy.
|
|
75
75
|
|
|
76
76
|
### Step 3: Estimate Token Count
|
|
77
77
|
|
|
@@ -198,15 +198,15 @@ Tell the user:
|
|
|
198
198
|
|
|
199
199
|
## Error Handling
|
|
200
200
|
|
|
201
|
-
- **Empty timeline:** "No observations found for project 'X'. Check the project name with: `memcurl
|
|
201
|
+
- **Empty timeline:** "No observations found for project 'X'. Check the project name with: `memcurl \"http://localhost:${WORKER_PORT}/api/search?query=*&limit=1\"`"
|
|
202
202
|
- **Worker not running:** "The memindex worker is not responding on port ${WORKER_PORT}. Start it with your usual method or check `ps aux | grep worker-service`."
|
|
203
|
-
- **Timeline too large:** For projects with 50,000+ observations, the timeline may exceed context limits. Suggest using date range filtering: `memcurl
|
|
203
|
+
- **Timeline too large:** For projects with 50,000+ observations, the timeline may exceed context limits. Suggest using date range filtering: `memcurl "http://localhost:${WORKER_PORT}/api/context/inject?project=X&full=true"` -- the current endpoint returns all observations; for extremely large projects, the user may want to analyze in time-windowed segments.
|
|
204
204
|
|
|
205
205
|
## Example
|
|
206
206
|
|
|
207
207
|
User: "Write a journey report for the tokyo project"
|
|
208
208
|
|
|
209
|
-
1. Fetch: `memcurl
|
|
209
|
+
1. Fetch: `memcurl "http://localhost:${WORKER_PORT}/api/context/inject?project=tokyo&full=true"`
|
|
210
210
|
2. Estimate: "Timeline fetched: ~34,722 observations, estimated ~718K tokens. Proceed?"
|
|
211
211
|
3. User confirms
|
|
212
212
|
4. Deploy analysis agent with full timeline
|
|
@@ -32,9 +32,9 @@ If the user wants a single sweeping report, use `timeline-report` instead. This
|
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
WORKER_PORT="${MEMINDEX_WORKER_PORT:-$(node -e "const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(38700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.memindex','settings.json'),'utf-8'));process.stdout.write(String(s.MEMINDEX_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}" 2>/dev/null)}"
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
# Set MEMINDEX_SKILL_DIR to the absolute directory containing this SKILL.md.
|
|
36
|
+
# The helper checks the worker's identity before sending the install secret.
|
|
37
|
+
memcurl() { node "${MEMINDEX_SKILL_DIR:?Set the installed skill directory}/../worker-request.mjs" "$@"; }
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Workflow
|
|
@@ -58,7 +58,7 @@ echo "$parent_project"
|
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
mkdir -p .scratch
|
|
61
|
-
memcurl
|
|
61
|
+
memcurl "http://localhost:${WORKER_PORT}/api/context/inject?project=PROJECT_NAME&full=true" \
|
|
62
62
|
> .scratch/cm-timeline.md
|
|
63
63
|
wc -l .scratch/cm-timeline.md
|
|
64
64
|
```
|
|
@@ -232,7 +232,7 @@ These rules emerged from running the pipeline end-to-end. Encode them every time
|
|
|
232
232
|
|
|
233
233
|
## Error Handling
|
|
234
234
|
|
|
235
|
-
- **Empty timeline**: project name wrong, or worker not running. `memcurl
|
|
235
|
+
- **Empty timeline**: project name wrong, or worker not running. `memcurl "http://localhost:${WORKER_PORT}/api/search?query=*&limit=1"` to verify.
|
|
236
236
|
- **Worker not running**: start it via your usual method or check `ps aux | grep worker-service`.
|
|
237
237
|
- **Subagent returns malformed carry-forward**: extract the carry-forward block by regex (` ```carry-forward ... ``` `) and pass forward verbatim. If missing, ask the agent to retry with the explicit instruction "your reply MUST include the carry-forward block fenced as ```carry-forward ... ``` at the very end."
|
|
238
238
|
- **One agent fails mid-pipeline**: retry that week with the same carry-forward. Don't skip — the chain breaks.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { closeSync, constants, fstatSync, openSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
const target = new URL(process.argv[2]);
|
|
8
|
+
const method = process.argv[3] ?? 'GET';
|
|
9
|
+
if (target.protocol !== 'http:' || !['localhost', '127.0.0.1', '[::1]'].includes(target.hostname)
|
|
10
|
+
|| target.username || target.password || !['GET', 'POST'].includes(method)) {
|
|
11
|
+
throw new Error('Expected a loopback worker URL and GET or POST.');
|
|
12
|
+
}
|
|
13
|
+
const dataDir = process.env.MEMINDEX_DATA_DIR || join(homedir(), '.memindex');
|
|
14
|
+
const fd = openSync(join(dataDir, 'worker-secret'), constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
15
|
+
let secret;
|
|
16
|
+
try {
|
|
17
|
+
const stat = fstatSync(fd);
|
|
18
|
+
if (!stat.isFile() || (process.getuid && stat.uid !== process.getuid())
|
|
19
|
+
|| (process.platform !== 'win32' && (stat.mode & 0o077) !== 0)) {
|
|
20
|
+
throw new Error('The worker secret must be an owner-only file.');
|
|
21
|
+
}
|
|
22
|
+
secret = readFileSync(fd, 'utf8');
|
|
23
|
+
if (!/^[a-f0-9]{64}$/.test(secret)) throw new Error('Invalid worker secret.');
|
|
24
|
+
} finally {
|
|
25
|
+
closeSync(fd);
|
|
26
|
+
}
|
|
27
|
+
const challenge = randomBytes(32).toString('hex');
|
|
28
|
+
const health = new URL('/api/health', target);
|
|
29
|
+
health.searchParams.set('challenge', challenge);
|
|
30
|
+
const response = await fetch(health, { redirect: 'error', signal: AbortSignal.timeout(2000) });
|
|
31
|
+
const { proof } = await response.json();
|
|
32
|
+
const expected = createHmac('sha256', secret).update('memindex-worker-identity:' + challenge).digest('hex');
|
|
33
|
+
if (!response.ok || typeof proof !== 'string' || !/^[a-f0-9]{64}$/.test(proof)
|
|
34
|
+
|| !timingSafeEqual(Buffer.from(proof), Buffer.from(expected))) {
|
|
35
|
+
throw new Error('The listener could not prove it is this install’s worker; nothing was sent.');
|
|
36
|
+
}
|
|
37
|
+
const result = await fetch(target, {
|
|
38
|
+
method, headers: { 'X-Memindex-Secret': secret }, redirect: 'error', signal: AbortSignal.timeout(30000),
|
|
39
|
+
});
|
|
40
|
+
if (!result.ok) throw new Error(`Worker request failed (${result.status}).`);
|
|
41
|
+
for await (const chunk of result.body ?? []) process.stdout.write(chunk);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(error instanceof Error ? error.message : 'Worker request failed.');
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
}
|