@iamem/amem 0.1.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/LICENSE +21 -0
- package/README.md +534 -0
- package/dist/activity.d.ts +27 -0
- package/dist/activity.js +202 -0
- package/dist/api/routes.d.ts +31 -0
- package/dist/api/routes.js +1345 -0
- package/dist/attest.d.ts +52 -0
- package/dist/attest.js +192 -0
- package/dist/backup-schedule.d.ts +25 -0
- package/dist/backup-schedule.js +216 -0
- package/dist/capture.d.ts +34 -0
- package/dist/capture.js +257 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1007 -0
- package/dist/context.d.ts +46 -0
- package/dist/context.js +334 -0
- package/dist/crypto.d.ts +39 -0
- package/dist/crypto.js +166 -0
- package/dist/db.d.ts +192 -0
- package/dist/db.js +666 -0
- package/dist/draft-quality.d.ts +19 -0
- package/dist/draft-quality.js +85 -0
- package/dist/embed.d.ts +76 -0
- package/dist/embed.js +331 -0
- package/dist/estimate.d.ts +32 -0
- package/dist/estimate.js +69 -0
- package/dist/freshness.d.ts +15 -0
- package/dist/freshness.js +93 -0
- package/dist/hook.d.ts +16 -0
- package/dist/hook.js +177 -0
- package/dist/hygiene-schedule.d.ts +28 -0
- package/dist/hygiene-schedule.js +221 -0
- package/dist/hygiene.d.ts +61 -0
- package/dist/hygiene.js +196 -0
- package/dist/install/claude.d.ts +6 -0
- package/dist/install/claude.js +69 -0
- package/dist/install/cursor.d.ts +7 -0
- package/dist/install/cursor.js +80 -0
- package/dist/install/hosts.d.ts +21 -0
- package/dist/install/hosts.js +186 -0
- package/dist/install/skills.d.ts +8 -0
- package/dist/install/skills.js +67 -0
- package/dist/it-pack.d.ts +20 -0
- package/dist/it-pack.js +84 -0
- package/dist/kinds.d.ts +18 -0
- package/dist/kinds.js +106 -0
- package/dist/license.d.ts +48 -0
- package/dist/license.js +172 -0
- package/dist/mcp.d.ts +40 -0
- package/dist/mcp.js +435 -0
- package/dist/paths.d.ts +11 -0
- package/dist/paths.js +55 -0
- package/dist/personal.d.ts +7 -0
- package/dist/personal.js +44 -0
- package/dist/platforms.d.ts +11 -0
- package/dist/platforms.js +32 -0
- package/dist/policy.d.ts +46 -0
- package/dist/policy.js +254 -0
- package/dist/prefs.d.ts +6 -0
- package/dist/prefs.js +11 -0
- package/dist/proposal.d.ts +90 -0
- package/dist/proposal.js +376 -0
- package/dist/publish.d.ts +28 -0
- package/dist/publish.js +57 -0
- package/dist/remember-contract.d.ts +23 -0
- package/dist/remember-contract.js +117 -0
- package/dist/repo-identity.d.ts +15 -0
- package/dist/repo-identity.js +82 -0
- package/dist/rules-sync.d.ts +7 -0
- package/dist/rules-sync.js +47 -0
- package/dist/savings-export.d.ts +49 -0
- package/dist/savings-export.js +141 -0
- package/dist/scan.d.ts +16 -0
- package/dist/scan.js +109 -0
- package/dist/search.d.ts +25 -0
- package/dist/search.js +150 -0
- package/dist/service.d.ts +20 -0
- package/dist/service.js +254 -0
- package/dist/shop.d.ts +9 -0
- package/dist/shop.js +15 -0
- package/dist/ui/server.d.ts +21 -0
- package/dist/ui/server.js +268 -0
- package/dist/vault.d.ts +25 -0
- package/dist/vault.js +42 -0
- package/dist/workspace-setup.d.ts +8 -0
- package/dist/workspace-setup.js +55 -0
- package/docs/agent-install-prompt.md +41 -0
- package/docs/backlog.md +59 -0
- package/docs/enterprise-endpoint.md +98 -0
- package/docs/license.md +54 -0
- package/docs/npm-release.md +38 -0
- package/docs/remember-contract.md +42 -0
- package/package.json +64 -0
- package/scripts/mdm-offboard.sh +14 -0
- package/skills/amem-bootstrap/SKILL.md +83 -0
- package/skills/amem-update-working-memory/SKILL.md +54 -0
- package/templates/cursor-rule.mdc +23 -0
- package/templates/mdm/co.amem.managed.plist +33 -0
- package/templates/policy.deny-default.toml +20 -0
- package/templates/policy.example.toml +22 -0
- package/ui-static/app.js +3966 -0
- package/ui-static/index.html +178 -0
- package/ui-static/orbit.js +389 -0
- package/ui-static/styles.css +2411 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { buildContext, renderContextMarkdown } from "./context.js";
|
|
2
|
+
import { insertUsageEvent } from "./db.js";
|
|
3
|
+
import { metricsFromPacket } from "./estimate.js";
|
|
4
|
+
import { applyProposal } from "./proposal.js";
|
|
5
|
+
import { parseWorkspaceSlug } from "./repo-identity.js";
|
|
6
|
+
export function provisionWorkspace(repo, platform = repo.platform || "app") {
|
|
7
|
+
const slug = parseWorkspaceSlug(repo.remote_url) ?? repo.repo_name;
|
|
8
|
+
const applied = applyProposal(repo.id, {
|
|
9
|
+
claims: [
|
|
10
|
+
{
|
|
11
|
+
id: "claim.workspace_binding",
|
|
12
|
+
kind: "structure",
|
|
13
|
+
text: `${slug} is a named amem workspace (not a git repo). Query it with workspace=${slug}. Memory stays in ~/.amem on this machine.`,
|
|
14
|
+
code_anchors: [slug],
|
|
15
|
+
source_ref: "workspace-setup",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "claim.workspace_use",
|
|
19
|
+
kind: "constraint",
|
|
20
|
+
text: `Any LLM client should retrieve amem context for workspace ${slug} before a model call, and remember durable outcomes after. Use POST /api/context and POST /api/remember, or the amem CLI.`,
|
|
21
|
+
code_anchors: [slug],
|
|
22
|
+
source_ref: "workspace-setup",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
const query = `What should I know about the ${slug} workspace?`;
|
|
27
|
+
const started = Date.now();
|
|
28
|
+
const packet = buildContext(repo.id, query, { rootPath: repo.root_path });
|
|
29
|
+
const markdown = renderContextMarkdown(packet);
|
|
30
|
+
const metrics = metricsFromPacket(packet, markdown);
|
|
31
|
+
insertUsageEvent({
|
|
32
|
+
repoId: repo.id,
|
|
33
|
+
platform,
|
|
34
|
+
query,
|
|
35
|
+
claimIds: metrics.claimIds,
|
|
36
|
+
anchorsCount: metrics.anchorsCount,
|
|
37
|
+
claimsCount: metrics.claimsCount,
|
|
38
|
+
packetTokens: metrics.packetTokens,
|
|
39
|
+
estimatedTokensSaved: metrics.estimatedTokensSaved,
|
|
40
|
+
localMs: Math.max(0, Date.now() - started),
|
|
41
|
+
estimatedMsSaved: metrics.estimatedMsSaved,
|
|
42
|
+
kind: metrics.kind,
|
|
43
|
+
});
|
|
44
|
+
const hay = markdown.toLowerCase();
|
|
45
|
+
const contextOk = hay.includes(slug.toLowerCase()) && hay.includes("workspace");
|
|
46
|
+
return {
|
|
47
|
+
workspace: slug,
|
|
48
|
+
seeded: applied.claims,
|
|
49
|
+
contextOk,
|
|
50
|
+
checks: [
|
|
51
|
+
`seeded ${applied.claims} starter facts`,
|
|
52
|
+
contextOk ? "context check: ok" : "context check: failed",
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Agent install prompt (amem)
|
|
2
|
+
|
|
3
|
+
Paste this into Cursor or Claude Code from inside the repository you want remembered:
|
|
4
|
+
|
|
5
|
+
`````txt
|
|
6
|
+
Install local personal amem memory for this repo.
|
|
7
|
+
|
|
8
|
+
Privacy rules (non-negotiable):
|
|
9
|
+
- Memory must stay on this machine under ~/.amem
|
|
10
|
+
- Do not write memory contents into the product git history
|
|
11
|
+
- Do not create PRs or shared docs that contain memory claims
|
|
12
|
+
- Do not upload or sync memory anywhere
|
|
13
|
+
|
|
14
|
+
Steps:
|
|
15
|
+
1. Ask me whether the platform is `cursor` or `claude` (pick the agent you are).
|
|
16
|
+
Other hosts also work: windsurf | continue | aider | zed.
|
|
17
|
+
2. From a checkout of the amem tool (or after npm link / global install), run:
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g .
|
|
20
|
+
# or: npm link
|
|
21
|
+
amem setup --personal
|
|
22
|
+
amem init --platform <cursor|claude>
|
|
23
|
+
amem doctor
|
|
24
|
+
amem status
|
|
25
|
+
```
|
|
26
|
+
If amem is already on PATH, skip install and just run setup/init/doctor/status.
|
|
27
|
+
3. Prefer the `amem-bootstrap` skill to seed a small baseline proposal, then:
|
|
28
|
+
```bash
|
|
29
|
+
amem propose validate <proposal.json>
|
|
30
|
+
amem propose diff <proposal.json>
|
|
31
|
+
amem propose apply <proposal.json>
|
|
32
|
+
amem context "What should I know before changing this repository?"
|
|
33
|
+
```
|
|
34
|
+
4. Confirm in one short paragraph: platform installed, DB path, claim count, and that memory is local-only.
|
|
35
|
+
5. Suggest `amem ui` — Setup scans local git repos; Memory shows pending session / miss→learn drafts (approve/dismiss), edit/pin/delete; optional login service keeps the UI on localhost after reboot.
|
|
36
|
+
6. Optional: `amem init --personal` for cross-repo prefs; `amem lock` / `amem backup schedule` for encrypt-at-rest and local encrypted backups (still no cloud).
|
|
37
|
+
7. Every MCP host must follow the remember contract (`amem recipe` or docs/remember-contract.md): call `amem_context` first, then `amem_remember` after durable outcomes. Do not treat a successful read as a substitute for writing.
|
|
38
|
+
|
|
39
|
+
Do not echo proprietary prompting strategy into claims. Store only durable repo facts with file anchors.
|
|
40
|
+
When correcting an old fact under a new claim id, use `"supersedes": ["claim.old_id"]`.
|
|
41
|
+
`````
|
package/docs/backlog.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# amem backlog (next)
|
|
2
|
+
|
|
3
|
+
Updated after completing the Feature Map **Later** phase (local embedding model + license/attest SKU).
|
|
4
|
+
|
|
5
|
+
## Shipped recently
|
|
6
|
+
|
|
7
|
+
- FTS retrieval, claim staleness, supersede/conflict
|
|
8
|
+
- Session-end **draft capture** + Memory approve/dismiss
|
|
9
|
+
- Memory **edit / delete / pin / search**
|
|
10
|
+
- Login service on **macOS + Linux + Windows**
|
|
11
|
+
- **Miss → learn** drafts after empty context lookups
|
|
12
|
+
- **Claim-kind ranking** + **Why:** explainability in context packets
|
|
13
|
+
- **`amem propose diff`** before apply
|
|
14
|
+
- Claude Code hooks call full `amem hook` pipeline
|
|
15
|
+
- **`amem setup`** / npx-ready package metadata
|
|
16
|
+
- Thin installers: **Windsurf, Continue, Aider, Zed**
|
|
17
|
+
- Cross-repo **personal** prefs workspace (`amem init --personal`)
|
|
18
|
+
- Optional **AES-256-GCM lock/unlock** + encrypted **backup** / schedule
|
|
19
|
+
- On-device **hashing embeddings** hybrid with FTS
|
|
20
|
+
- Smarter multi-turn draft compaction + **`auto_apply_kinds`** policy
|
|
21
|
+
- **CI + pack:check** for `npx @iamem/amem setup` (release workflow on `v*` tags; see `docs/npm-release.md`)
|
|
22
|
+
- **Remember contract** — `amem recipe`, `GET /api/recipe`, MCP `amem_recipe`, Setup copy card
|
|
23
|
+
- **Memory / header chrome** — lock indicator, backup status + schedule, **Personal** switcher
|
|
24
|
+
- **Draft quality scoring** — confidence 0–100; reject noisy session-end drafts; Memory “Reject noisy”
|
|
25
|
+
- **Conflict UI** — structured supersede suggestions; apply requires `resolve=supersede|keep` when facts overlap
|
|
26
|
+
- **Savings export** — `amem usage export` / Stats JSON · markdown · PDF (proxy, not a bill)
|
|
27
|
+
- **Richer host adapters** — Continue `mcpServers/amem.yaml`, Zed HTTP `url`, doctor health for continue/zed/windsurf
|
|
28
|
+
- **Local n-gram embedder** — Pro/IT; no model download, no cloud API (`amem embed use ngram`)
|
|
29
|
+
- **License + IT attest SKU** — vendor-signed license only; IT attest adds vault/host packet
|
|
30
|
+
|
|
31
|
+
- **Auto-capture** — high-quality session-end facts apply without `amem_remember`
|
|
32
|
+
- **Restore** — `amem restore --file` + vault UI path (encrypted or plaintext backup)
|
|
33
|
+
- **Hygiene** — Pro: unused decay, near-duplicate merge, Memory Review inbox
|
|
34
|
+
- **External embedder** — Pro: local stdin/stdout command (Ollama, llama.cpp, your script)
|
|
35
|
+
- **IT pack** — `amem it-pack` + `amem doctor --sbom` (deny-default policy, MDM plist, offboard)
|
|
36
|
+
- **Pin → Cursor rules** — Pro: `amem rules sync` writes `.cursor/rules/amem-pinned.mdc`
|
|
37
|
+
|
|
38
|
+
## Open
|
|
39
|
+
|
|
40
|
+
- First npm publish of `@iamem/amem` (org `@iamem` already exists; need valid `NPM_TOKEN` / `npm login`, then tag `v0.1.0` or `npm publish --access public`).
|
|
41
|
+
- Prompt-pack before/after Stats benchmark; restore wizard polish; IT seat pack.
|
|
42
|
+
- Decide one-time vs subscription (offline files cannot revoke on cancel unless you add `expires_at` and re-issue).
|
|
43
|
+
- Optional vendored ONNX/MiniLM weights in a paid pack (external command is the local hook today).
|
|
44
|
+
|
|
45
|
+
## Shipped (go-to-market / upsell)
|
|
46
|
+
|
|
47
|
+
- Public Checkout at **getamem.com** (tryamem redirects); Stripe live webhook.
|
|
48
|
+
- Mailtrap **live send** (`MAILTRAP_USE_TESTING=false`); thank-you download still works if mail fails.
|
|
49
|
+
- Package renamed to `@iamem/amem` (CLI binary still `amem`); shop install copy updated.
|
|
50
|
+
- UI **Apply license** (paste/drop) + **Turn on Pro retrieval** checklist.
|
|
51
|
+
- Memory **retrieval showdown** (free hash vs Pro n-gram) + top-bar **Try retrieval**.
|
|
52
|
+
- Remember-contract guidance: prefer durable kinds; avoid `session` spam.
|
|
53
|
+
- **Hygiene auto-cleanup** — `accept-safe`, weekly OS schedule, soft paywall banner at ~200 facts / noisy dups (free preview; apply stays Pro).
|
|
54
|
+
|
|
55
|
+
## Explicit non-goals (keep)
|
|
56
|
+
|
|
57
|
+
- Cloud/team sync, shared org brain, hosted RAG
|
|
58
|
+
- Exact Cursor/Anthropic billing integration
|
|
59
|
+
- Writing memory into product git history
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# amem enterprise endpoint (IT route)
|
|
2
|
+
|
|
3
|
+
Personal memory stays on the laptop. IT governs **install, policy, attestation, and offboarding** — not a shared cloud brain.
|
|
4
|
+
|
|
5
|
+
## What security review gets
|
|
6
|
+
|
|
7
|
+
| Guarantee | How to verify |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| No telemetry | Forced `telemetry = false`; attest report |
|
|
10
|
+
| No network egress from amem | Attest: `network_egress: "none"` |
|
|
11
|
+
| Localhost UI only | Binds `127.0.0.1` only |
|
|
12
|
+
| Memory permissions | `~/.amem` mode `0700` |
|
|
13
|
+
| Secret hygiene | Builtin + policy `deny_claim_patterns` on propose |
|
|
14
|
+
| Export control | `allow_export = false` in system policy |
|
|
15
|
+
| Platform allowlist | `allowed_platforms` |
|
|
16
|
+
| Repo allowlist | `allowed_remote_hosts` |
|
|
17
|
+
| Draft auto-apply | `auto_apply_kinds` (default empty = Memory approve only) |
|
|
18
|
+
| Optional at-rest encryption | User/local `amem lock` + encrypted `amem backup` (still no sync) |
|
|
19
|
+
| License SKU | Vendor-signed `amem-license.json` only (`amem license apply`). Self-issued /dev unlocks are rejected. IT tier adds vault/host fields to attest |
|
|
20
|
+
|
|
21
|
+
## IT pack (one folder for the security ticket)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
amem it-pack --out ~/Desktop/amem-it-pack
|
|
25
|
+
amem doctor --sbom --out ~/Desktop/amem-it-pack/sbom.json
|
|
26
|
+
amem doctor --attest --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The pack includes deny-by-default `policy.toml`, an MDM plist stub, `mdm-offboard.sh`, and a CycloneDX-lite SBOM. Signed installers still need your org’s cert — amem does not upload binaries.
|
|
30
|
+
|
|
31
|
+
## Install (DevEx / IT)
|
|
32
|
+
|
|
33
|
+
1. Ship a pinned amem build (internal npm, pkg, or `npm link` from a mirrored clone). Node 20+ required (`better-sqlite3`).
|
|
34
|
+
2. Deploy policy:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
sudo mkdir -p /etc/amem
|
|
38
|
+
sudo cp templates/policy.example.toml /etc/amem/policy.toml
|
|
39
|
+
sudo chmod 644 /etc/amem/policy.toml
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
3. Optional MDM: install binary + copy policy + run doctor on first login.
|
|
43
|
+
4. End users typically run `amem setup` then `amem ui` (or `amem service install` for login auto-start on macOS / Linux / Windows).
|
|
44
|
+
|
|
45
|
+
## Attestation (ticket attachment)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
amem doctor --attest
|
|
49
|
+
# machine-readable only:
|
|
50
|
+
amem doctor --attest --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Attach the JSON to security / IT tickets. It includes effective policy, memory path/mode, and install health.
|
|
54
|
+
|
|
55
|
+
HTTP (local UI only): `GET /api/attest`
|
|
56
|
+
|
|
57
|
+
## Policy knobs
|
|
58
|
+
|
|
59
|
+
See [templates/policy.example.toml](../templates/policy.example.toml).
|
|
60
|
+
|
|
61
|
+
| Key | Effect |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `allow_export` | Blocks `amem export` when false |
|
|
64
|
+
| `ui_enabled` | Blocks `amem ui` when false |
|
|
65
|
+
| `allowed_platforms` | Restricts `init` / setup (cursor, claude, windsurf, …) |
|
|
66
|
+
| `allowed_remote_hosts` | Restricts which git remotes can init/apply |
|
|
67
|
+
| `deny_claim_patterns` | Extra regexes blocked in claim text/anchors |
|
|
68
|
+
| `auto_apply_kinds` | Draft kinds that may auto-apply without Memory approve (empty = never) |
|
|
69
|
+
|
|
70
|
+
Hard stops (not overridable): telemetry stays off; UI bind forced to loopback.
|
|
71
|
+
|
|
72
|
+
## Local UI / MCP CORS threat model
|
|
73
|
+
|
|
74
|
+
`amem ui` binds **127.0.0.1 only**. HTTP responses (including MCP) set `Access-Control-Allow-Origin: *` so local hosts (Cursor, Claude, browser tools) can call the loopback API without a special Origin.
|
|
75
|
+
|
|
76
|
+
That is not a remote public API:
|
|
77
|
+
|
|
78
|
+
- Nothing in `~/.amem` is uploaded or synced.
|
|
79
|
+
- Binding is loopback-only — LAN/WAN clients cannot reach the UI by default.
|
|
80
|
+
- Treat any process on the same machine as potentially able to call `127.0.0.1:7843` while the UI is running (same as any local MCP server).
|
|
81
|
+
|
|
82
|
+
## Offboarding
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
amem wipe --all --yes
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Deletes all local repos in the DB and removes `~/.amem` (memory, sessions, user policy, local backups under that home). Safe to run from MDM logout scripts — see [scripts/mdm-offboard.sh](../scripts/mdm-offboard.sh).
|
|
89
|
+
|
|
90
|
+
If the DB was locked (`graph.db.enc`), wipe still removes the amem home after unlock/offboard per your runbook; prefer unlocking or wiping the whole home directory.
|
|
91
|
+
|
|
92
|
+
## Support checklist
|
|
93
|
+
|
|
94
|
+
- Pin Node 20+ and amem version in the internal package
|
|
95
|
+
- Re-run `amem doctor --attest` after Cursor / Claude Code / host updates
|
|
96
|
+
- Keep `/etc/amem/policy.toml` root-owned
|
|
97
|
+
- Do not commit personal exports or encrypted backup blobs to product git history
|
|
98
|
+
- Leave `auto_apply_kinds` empty unless DevEx intentionally allows low-risk kinds
|
package/docs/license.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# amem license SKU
|
|
2
|
+
|
|
3
|
+
Memory still never leaves the laptop. A license only unlocks **local** extras.
|
|
4
|
+
|
|
5
|
+
| Tier | What it unlocks |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| **free** | Memory UI, MCP, stats, backups |
|
|
8
|
+
| **pro** | Local n-gram or **external** embedder, hygiene (inbox + weekly schedule + accept-safe), pin → Cursor rules |
|
|
9
|
+
| **it** | Pro + richer `amem doctor --attest` packet (the exclusive). `amem it-pack` templates are available on Free. |
|
|
10
|
+
|
|
11
|
+
There is no license server and no telemetry. Pro/IT requires a **vendor-signed** `amem-license.json` (Ed25519). Self-issued / `--dev` unlocks are not accepted.
|
|
12
|
+
|
|
13
|
+
## Buy + apply
|
|
14
|
+
|
|
15
|
+
Prices (one-time, live): **Pro $12**, **IT $49** at [getamem.com](https://getamem.com). After pay, download `amem-license.json` from the thank-you page.
|
|
16
|
+
|
|
17
|
+
**Apply in the UI (recommended):** open `amem ui` → Plans or Setup → paste the JSON or choose the file → Apply license. Then **Turn on Pro retrieval** (n-gram + reindex). Memory tab has a **retrieval showdown** (free hash vs Pro n-gram).
|
|
18
|
+
|
|
19
|
+
Or from a terminal:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
amem license apply --file ~/Downloads/amem-license.json
|
|
23
|
+
amem license status
|
|
24
|
+
amem embed use ngram && amem embed reindex
|
|
25
|
+
amem hygiene
|
|
26
|
+
amem hygiene --accept-safe
|
|
27
|
+
amem hygiene schedule
|
|
28
|
+
amem rules sync
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The published CLI has no Stripe keys. A separate **shop** process (not shipped on npm) runs Checkout and emails a signed JSON via Mailtrap. See [shop/README.md](../shop/README.md).
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# seller (this repo, not published) — local only
|
|
35
|
+
cd shop && npm install && npm start
|
|
36
|
+
stripe listen --forward-to localhost:8788/webhook
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or issue one file yourself with the vendor private key (never commit it):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
amem license keys --out-dir shop/.data
|
|
43
|
+
AMEM_LICENSE_PRIVKEY=… amem license issue --tier pro --subject acme --out acme.json
|
|
44
|
+
amem license apply --file acme.json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Verify uses the public key in `src/license.ts` (override with `AMEM_LICENSE_PUBKEY` in tests only).
|
|
48
|
+
|
|
49
|
+
## Clear
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
amem license clear
|
|
53
|
+
amem embed use hash
|
|
54
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# npm release
|
|
2
|
+
|
|
3
|
+
Published package: **`@iamem/amem`** (CLI binary name stays `amem`).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @iamem/amem setup
|
|
7
|
+
# or
|
|
8
|
+
npm i -g @iamem/amem && amem setup
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Unscoped `amem` is blocked on the registry (“too similar” to existing packages). The scoped name is the supported install path.
|
|
12
|
+
|
|
13
|
+
`better-sqlite3` ships its own prebuilds. Users need **Node.js 20+**. If a prebuild is missing, npm falls back to compiling (needs a C++ toolchain: Xcode CLT on macOS, `build-essential` on Debian/Ubuntu).
|
|
14
|
+
|
|
15
|
+
## What CI does
|
|
16
|
+
|
|
17
|
+
- `.github/workflows/ci.yml` — `npm test` + `npm run pack:check` on Node 20 and 22 (macOS + Ubuntu).
|
|
18
|
+
- `.github/workflows/release.yml` — on a `v*` tag, publish to npm if `NPM_TOKEN` is set.
|
|
19
|
+
|
|
20
|
+
This repo does **not** auto-publish on every push.
|
|
21
|
+
|
|
22
|
+
## Release checklist
|
|
23
|
+
|
|
24
|
+
1. `npm test` and `npm run pack:check` are green locally.
|
|
25
|
+
2. Bump `version` in `package.json`.
|
|
26
|
+
3. Commit, tag, push:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git tag v0.1.0
|
|
30
|
+
git push origin main --tags
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
4. Ensure `NPM_TOKEN` repo secret is an Automation token with publish rights to `@iamem`.
|
|
34
|
+
5. Confirm `npx @iamem/amem setup` from a folder that is not this checkout.
|
|
35
|
+
|
|
36
|
+
## Pack contents
|
|
37
|
+
|
|
38
|
+
`package.json#files` includes `dist`, `ui-static`, `docs`, `skills`, and `scripts/mdm-offboard.sh`. Native code is pulled in as the `better-sqlite3` dependency — do not vendor it.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# amem remember contract (v1)
|
|
2
|
+
|
|
3
|
+
Generic MCP host recipe. Same tools for every client — do not fork per product.
|
|
4
|
+
|
|
5
|
+
## Connect
|
|
6
|
+
|
|
7
|
+
Keep `amem ui` running, then attach:
|
|
8
|
+
|
|
9
|
+
`http://127.0.0.1:7843/mcp?workspace=<slug>`
|
|
10
|
+
|
|
11
|
+
GUI hosts often cannot see Homebrew on PATH. Prefer the HTTP URL over a bare `amem` command.
|
|
12
|
+
|
|
13
|
+
Print this from any machine with amem installed:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
amem recipe
|
|
17
|
+
# or: curl -s http://127.0.0.1:7843/api/recipe
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Hosts can also call the `amem_recipe` MCP tool.
|
|
21
|
+
|
|
22
|
+
## Tools
|
|
23
|
+
|
|
24
|
+
- `amem_context` (read) — Before exploring files or sending a large prompt. Pass `workspace=<slug>`.
|
|
25
|
+
- `amem_remember` (write) — After a durable outcome: a decision, constraint, owner, or gotcha that should survive this chat.
|
|
26
|
+
- `amem_recipe` (meta) — If you are unsure when to read or write — fetch this contract.
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
- Must: Call `amem_context` at the start of a task. Do not treat a successful read as a substitute for writing later.
|
|
31
|
+
- Must: Call `amem_remember` when the user confirms a durable fact, or when you discover a constraint that the next session will need.
|
|
32
|
+
- Must: Memory stays on this machine under `~/.amem`. Do not upload claims, paste them into shared docs, or commit them to product git.
|
|
33
|
+
- Must: Never remember passwords, API keys, tokens, or private key material.
|
|
34
|
+
- Must: Store repo or workspace facts with file anchors — not proprietary prompting strategy.
|
|
35
|
+
- Must: Prefer kinds constraint, gotcha, structure, howto, or owner. Use kind=session only for short-lived chat takeaways — session spam drowns retrieval.
|
|
36
|
+
- Must: Named workspaces are not git repos. Always pass the workspace slug on context and remember.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
1. `amem_context` query="What should I know before changing auth?" workspace=my-app
|
|
41
|
+
2. Do the work, verify files.
|
|
42
|
+
3. `amem_remember` text="Auth mode is checked in src/auth.ts before Drive sync" workspace=my-app kind=constraint anchors=["src/auth.ts"]
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iamem/amem",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local personal agent memory for Cursor and Claude Code. Private to your machine — never shared.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"amem": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/cli.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"preferGlobal": true,
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"skills",
|
|
20
|
+
"templates",
|
|
21
|
+
"docs",
|
|
22
|
+
"ui-static",
|
|
23
|
+
"scripts/mdm-offboard.sh"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"dev": "tsc --watch",
|
|
28
|
+
"prepare": "npm run build",
|
|
29
|
+
"amem": "node dist/cli.js",
|
|
30
|
+
"smoke": "node scripts/smoke.mjs",
|
|
31
|
+
"pack:check": "npm run build && node scripts/check-pack.mjs",
|
|
32
|
+
"prepublishOnly": "npm test && node scripts/check-pack.mjs",
|
|
33
|
+
"test": "npm run build && node --test --test-concurrency=1 test/**/*.test.mjs",
|
|
34
|
+
"test:all": "npm run test && npm run smoke && node scripts/check-pack.mjs",
|
|
35
|
+
"shop": "node shop/server.mjs"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"agent-memory",
|
|
42
|
+
"cursor",
|
|
43
|
+
"claude-code",
|
|
44
|
+
"local",
|
|
45
|
+
"sqlite"
|
|
46
|
+
],
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/sslugic/amem.git"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/sslugic/amem#readme",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/sslugic/amem/issues"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"better-sqlite3": "^12.11.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
61
|
+
"@types/node": "^22.15.0",
|
|
62
|
+
"typescript": "^5.8.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# IT / MDM offboarding helper — wipe personal amem data for the current user.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
AMEM_BIN="${AMEM_BIN:-amem}"
|
|
6
|
+
|
|
7
|
+
if command -v "$AMEM_BIN" >/dev/null 2>&1; then
|
|
8
|
+
"$AMEM_BIN" wipe --all --yes || true
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
# Belt-and-suspenders if the CLI was already uninstalled.
|
|
12
|
+
rm -rf "${AMEM_HOME:-$HOME/.amem}"
|
|
13
|
+
|
|
14
|
+
echo "amem offboard complete for ${USER:-unknown}"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Seed local personal amem memory for the current repository from durable repo structure facts.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# amem-bootstrap
|
|
6
|
+
|
|
7
|
+
Create an initial local memory proposal for this repository.
|
|
8
|
+
|
|
9
|
+
## Privacy
|
|
10
|
+
|
|
11
|
+
Memory is personal and stored only under `~/.amem` on this machine. Do not commit proposal files, exports, backups, or database copies to shared git remotes.
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Confirm amem is initialized:
|
|
16
|
+
```bash
|
|
17
|
+
amem status
|
|
18
|
+
```
|
|
19
|
+
If not initialized, ask the user which platform (`cursor`, `claude`, or another host) and run:
|
|
20
|
+
```bash
|
|
21
|
+
amem setup --personal
|
|
22
|
+
amem init --platform <platform>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Inspect the repo at a high level (README, top-level dirs, obvious entrypoints). Do not dump proprietary prompt strategy into claims.
|
|
26
|
+
|
|
27
|
+
3. Write a proposal JSON file (for example `/tmp/amem-bootstrap.json`) with durable facts only:
|
|
28
|
+
- `components`: major subsystems with optional `code_anchor`
|
|
29
|
+
- `flows`: important workflows
|
|
30
|
+
- `claims`: concrete facts with at least one `code_anchors` path each
|
|
31
|
+
- `edges`: link claims→flows and flows→components when useful
|
|
32
|
+
|
|
33
|
+
Prefer claim kinds: `constraint`, `gotcha`, `owner`, `howto`, `structure` (avoid noisy `session` for bootstrap).
|
|
34
|
+
|
|
35
|
+
Example shape:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"components": [
|
|
40
|
+
{ "id": "component.api", "name": "HTTP API", "code_anchor": "src/api" }
|
|
41
|
+
],
|
|
42
|
+
"flows": [
|
|
43
|
+
{ "id": "flow.request_lifecycle", "name": "Request lifecycle" }
|
|
44
|
+
],
|
|
45
|
+
"claims": [
|
|
46
|
+
{
|
|
47
|
+
"id": "claim.api_entry",
|
|
48
|
+
"kind": "structure",
|
|
49
|
+
"text": "HTTP handlers live under src/api.",
|
|
50
|
+
"code_anchors": ["src/api"]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"edges": [
|
|
54
|
+
{
|
|
55
|
+
"from_id": "claim.api_entry",
|
|
56
|
+
"from_type": "claim",
|
|
57
|
+
"to_id": "flow.request_lifecycle",
|
|
58
|
+
"to_type": "flow",
|
|
59
|
+
"kind": "about"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"from_id": "flow.request_lifecycle",
|
|
63
|
+
"from_type": "flow",
|
|
64
|
+
"to_id": "component.api",
|
|
65
|
+
"to_type": "component",
|
|
66
|
+
"kind": "uses"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
When correcting a prior fact under a new claim id, include `"supersedes": ["claim.old_id"]` so the old claim is archived locally.
|
|
73
|
+
|
|
74
|
+
4. Validate, preview, and apply locally:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
amem propose validate /tmp/amem-bootstrap.json
|
|
78
|
+
amem propose diff /tmp/amem-bootstrap.json
|
|
79
|
+
amem propose apply /tmp/amem-bootstrap.json
|
|
80
|
+
amem context "What should I know before changing this repository?"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
5. Tell the user in one line that baseline local memory was applied. Mention `amem ui` → Memory for future session drafts. Do not print the full proposal unless asked.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Save durable learnings from the current session into local personal amem memory.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# amem-update-working-memory
|
|
6
|
+
|
|
7
|
+
Extract durable engineering facts from this session and store them in local amem memory.
|
|
8
|
+
|
|
9
|
+
## Privacy
|
|
10
|
+
|
|
11
|
+
- Write only to the local amem database via the CLI.
|
|
12
|
+
- Do not create shared docs, PRs, or commits that contain memory contents.
|
|
13
|
+
- Do not store secrets, tokens, credentials, or private personal data.
|
|
14
|
+
- Do not store proprietary company LLM instruction text — only durable repo facts (constraints, ownership, gotchas, workflows).
|
|
15
|
+
|
|
16
|
+
After useful exploratory or implementation work that produced durable knowledge about this repository.
|
|
17
|
+
|
|
18
|
+
Usage logging: every `amem context` call already records an estimated token savings event locally. If you later know a better avoided-token number from the agent UI, you may run:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
amem usage report --platform <cursor|claude> --saved <n>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Session-end / miss→learn drafts may already be waiting in Memory (`amem ui`). Prefer approving those when they match this session; use this skill for higher-quality curated claims.
|
|
25
|
+
|
|
26
|
+
## Steps
|
|
27
|
+
|
|
28
|
+
1. Check binding:
|
|
29
|
+
```bash
|
|
30
|
+
amem status
|
|
31
|
+
```
|
|
32
|
+
If uninitialized, stop and ask the user to run `amem init` (or `amem setup`).
|
|
33
|
+
|
|
34
|
+
2. Draft a small proposal JSON (prefer `/tmp/amem-update-<date>.json`) with only new or corrected durable claims. Prefer updating existing claim ids when correcting prior memory. When a new claim replaces an old one under a **new** id, set `"supersedes": ["claim.old_id"]` (or an edge with `kind: "supersedes"`) so the old claim leaves retrieval.
|
|
35
|
+
|
|
36
|
+
3. Every claim must include at least one `code_anchors` path that exists in the repo. Prefer kinds `constraint`, `gotcha`, `owner`, `howto`, `structure`. If validate prints **conflict warnings** (shared anchors + similar text), resolve them with `supersedes` or by updating the existing id.
|
|
37
|
+
|
|
38
|
+
4. Validate, preview, and apply:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
amem propose validate /tmp/amem-update-<date>.json
|
|
42
|
+
amem propose diff /tmp/amem-update-<date>.json
|
|
43
|
+
amem propose apply /tmp/amem-update-<date>.json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
5. Optionally verify:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
amem context "<short keywords from the new claims>"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Confirm the packet shows **Why:** ranking factors and that new claims appear.
|
|
53
|
+
|
|
54
|
+
6. Reply briefly with how many claims/flows/components were saved. Keep claim text out of chat unless the user asks.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Use local personal amem memory before broad codebase exploration
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Generated by amem. Safe to commit: contains no memory contents. -->
|
|
8
|
+
|
|
9
|
+
# amem local memory
|
|
10
|
+
|
|
11
|
+
amem injects matching local memory into Cursor automatically (session start + each prompt). Treat that packet as the first map of this repo.
|
|
12
|
+
|
|
13
|
+
1. Prefer amem file anchors over broad greps and multi-folder reads.
|
|
14
|
+
2. Still verify current code before editing — memory can be stale. Trust **fresh** claims more; re-check anything marked **stale**.
|
|
15
|
+
3. Use the **Why:** line as ranking explainability, not as proof.
|
|
16
|
+
4. After durable learnings, the stop hook queues a compact **session draft** (and may queue **miss→learn** drafts). Approve in `amem ui` → Memory, or run `amem-update-working-memory` for higher-quality facts.
|
|
17
|
+
5. Cross-repo personal prefs may appear with Why reason `personal` — they are local “how I work” notes, not org wiki.
|
|
18
|
+
|
|
19
|
+
Do not re-run `amem context` unless the injected packet is empty or clearly wrong.
|
|
20
|
+
|
|
21
|
+
Memory is personal and stored under `~/.amem` on this machine. Do not commit exports, backups, or database copies to shared remotes.
|
|
22
|
+
|
|
23
|
+
Open the local UI anytime with `amem ui` (Setup, Memory drafts, Stats).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>PayloadDisplayName</key>
|
|
6
|
+
<string>amem local memory (IT)</string>
|
|
7
|
+
<key>PayloadIdentifier</key>
|
|
8
|
+
<string>co.amem.managed</string>
|
|
9
|
+
<key>PayloadType</key>
|
|
10
|
+
<string>Configuration</string>
|
|
11
|
+
<key>PayloadUUID</key>
|
|
12
|
+
<string>a1e00000-0000-4000-8000-000000000001</string>
|
|
13
|
+
<key>PayloadVersion</key>
|
|
14
|
+
<integer>1</integer>
|
|
15
|
+
<key>PayloadOrganization</key>
|
|
16
|
+
<string>Your org — wrap this in MDM; amem never phones home</string>
|
|
17
|
+
<key>PayloadContent</key>
|
|
18
|
+
<array>
|
|
19
|
+
<dict>
|
|
20
|
+
<key>PayloadType</key>
|
|
21
|
+
<string>com.apple.ManagedClient.preferences</string>
|
|
22
|
+
<key>PayloadIdentifier</key>
|
|
23
|
+
<string>co.amem.managed.policy</string>
|
|
24
|
+
<key>PayloadUUID</key>
|
|
25
|
+
<string>a1e00000-0000-4000-8000-000000000002</string>
|
|
26
|
+
<key>PayloadEnabled</key>
|
|
27
|
+
<true/>
|
|
28
|
+
<key>PayloadDisplayName</key>
|
|
29
|
+
<string>Deploy /etc/amem/policy.toml via your MDM file payload</string>
|
|
30
|
+
</dict>
|
|
31
|
+
</array>
|
|
32
|
+
</dict>
|
|
33
|
+
</plist>
|