agent-memory-hub 0.0.0-stage → 0.1.1
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 +62 -2
- package/dist/cli.d.ts +45 -0
- package/dist/cli.js +736 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/approval.d.ts +23 -0
- package/dist/core/approval.js +18 -0
- package/dist/core/approval.js.map +1 -0
- package/dist/core/atomic.d.ts +6 -0
- package/dist/core/atomic.js +37 -0
- package/dist/core/atomic.js.map +1 -0
- package/dist/core/errors.d.ts +17 -0
- package/dist/core/errors.js +22 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/extract.d.ts +48 -0
- package/dist/core/extract.js +71 -0
- package/dist/core/extract.js.map +1 -0
- package/dist/core/frontmatter.d.ts +26 -0
- package/dist/core/frontmatter.js +310 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/hub.d.ts +25 -0
- package/dist/core/hub.js +151 -0
- package/dist/core/hub.js.map +1 -0
- package/dist/core/ids.d.ts +13 -0
- package/dist/core/ids.js +45 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/inject.d.ts +44 -0
- package/dist/core/inject.js +62 -0
- package/dist/core/inject.js.map +1 -0
- package/dist/core/journal.d.ts +25 -0
- package/dist/core/journal.js +73 -0
- package/dist/core/journal.js.map +1 -0
- package/dist/core/ledger.d.ts +32 -0
- package/dist/core/ledger.js +35 -0
- package/dist/core/ledger.js.map +1 -0
- package/dist/core/lock.d.ts +51 -0
- package/dist/core/lock.js +109 -0
- package/dist/core/lock.js.map +1 -0
- package/dist/core/registry.d.ts +44 -0
- package/dist/core/registry.js +89 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/search.d.ts +59 -0
- package/dist/core/search.js +189 -0
- package/dist/core/search.js.map +1 -0
- package/dist/core/store.d.ts +89 -0
- package/dist/core/store.js +296 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/time.d.ts +5 -0
- package/dist/core/time.js +21 -0
- package/dist/core/time.js.map +1 -0
- package/dist/core/transcript.d.ts +42 -0
- package/dist/core/transcript.js +77 -0
- package/dist/core/transcript.js.map +1 -0
- package/dist/core/types.d.ts +47 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/validate.d.ts +19 -0
- package/dist/core/validate.js +94 -0
- package/dist/core/validate.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/transport/autocommit.d.ts +11 -0
- package/dist/transport/autocommit.js +25 -0
- package/dist/transport/autocommit.js.map +1 -0
- package/dist/transport/http.d.ts +13 -0
- package/dist/transport/http.js +56 -0
- package/dist/transport/http.js.map +1 -0
- package/dist/transport/mcp.d.ts +27 -0
- package/dist/transport/mcp.js +498 -0
- package/dist/transport/mcp.js.map +1 -0
- package/dist/transport/panel.d.ts +8 -0
- package/dist/transport/panel.js +207 -0
- package/dist/transport/panel.js.map +1 -0
- package/dist/transport/server.d.ts +23 -0
- package/dist/transport/server.js +349 -0
- package/dist/transport/server.js.map +1 -0
- package/package.json +60 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zhiwuli0228
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# agent-memory-hub
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Agent memory bridge** — local-first, human-approved, file-native long-term memory for AI coding agents.
|
|
4
|
+
>
|
|
5
|
+
> One local service. Every agent shares it. Claude Code, Codex, opencode, gemini-cli, DSH — anything that speaks MCP or a shell.
|
|
6
|
+
|
|
7
|
+
## It is
|
|
8
|
+
|
|
9
|
+
- **Local-first** — your memory lives in plain Markdown files you own (`knowledge/`), versioned in `history/`, git-friendly. No cloud required. No black-box database.
|
|
10
|
+
- **Human-approved** — agents can *propose* memories; only you can commit them. Every stored fact is traceable: who approved it, when, and from which conversation.
|
|
11
|
+
- **File-native** — Markdown + YAML frontmatter + JSONL ledger. Open it, diff it, grep it, back it up with git.
|
|
12
|
+
- **Cross-host by design** — one MCP server + one CLI (`memhub`) + one optional local dashboard, all backed by the same files. Register once, every agent shares the same memory.
|
|
13
|
+
- **Scoped** — project → domain → global knowledge hierarchy with ancestor-chain search. Each agent sees exactly the layers it should.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
**DSH plugin** (DeepSeek Harness users):
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
install_bundle dsh-agent-memory-hub
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Tool surface: 8 `memory_*` tools (search / get / status / propose / preflight / cite / journal / close-task). Runtime is **zero-network** — a dead remote never degrades your host. Details: [host/dsh/README.md](host/dsh/README.md) · [部署对接指南](docs/03-usage/memory-hub-deployment.md).
|
|
24
|
+
|
|
25
|
+
**CLI / MCP server** (Claude Code, OpenCode, Codex, gemini-cli, any MCP host):
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm i -g agent-memory-hub
|
|
29
|
+
memhub mcp --root <hub> # register in any MCP client
|
|
30
|
+
memhub extract material # scheduled-extraction material for any workflow platform
|
|
31
|
+
memhub publish # publish approved entries to your team's memory-hub API (ADR-0015)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Team memory-hub service**: implement or deploy [docs/02-spec/memory-hub-api-v1.md](docs/02-spec/memory-hub-api-v1.md) (reference server included: `examples/memory-hub-server.mjs`).
|
|
35
|
+
|
|
36
|
+
## Status
|
|
37
|
+
|
|
38
|
+
🚧 **Under active development** (this repo was founded 2026-11-15). The stable, working edition of the same memory format is [`dsh-memory-hub`](https://www.npmjs.com/package/dsh-memory-hub) (DSH plugin, v0.8.x). `agent-memory-hub` generalizes it into a standalone cross-host service; the first stable release targets **0.1.0**.
|
|
39
|
+
|
|
40
|
+
## Design principles
|
|
41
|
+
|
|
42
|
+
Four invariants (see [AGENTS.md](AGENTS.md)):
|
|
43
|
+
|
|
44
|
+
1. Files are the authority, not a cache.
|
|
45
|
+
2. Humans approve; agents propose. Never self-commit.
|
|
46
|
+
3. Plain text only — readable, diffable, migratable.
|
|
47
|
+
4. Zero network by default.
|
|
48
|
+
|
|
49
|
+
Eight day-zero architecture decisions in [docs/01-architecture/decisions/ADR-0001-day-zero-principles.md](docs/01-architecture/decisions/ADR-0001-day-zero-principles.md).
|
|
50
|
+
|
|
51
|
+
## Roadmap
|
|
52
|
+
|
|
53
|
+
| Step | Deliverable |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| 1 ✅ | Repo skeleton, invariants, format contract tests |
|
|
56
|
+
| 2 | `core` — storage, retrieval (BM25), workspace pyramid registry |
|
|
57
|
+
| 3 | `transport` — MCP stdio + CLI, re-verified on four hosts |
|
|
58
|
+
| 4 | Approval + ledger + local dashboard (`memhub serve`) |
|
|
59
|
+
| 5 | Injector / extractor first-class commands (`memhub pack / hook / extract`) |
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LEDGER_FILE, readHubConfig } from './core/hub.js';
|
|
2
|
+
import { readLedger } from './core/ledger.js';
|
|
3
|
+
import { registerWorkspace } from './core/registry.js';
|
|
4
|
+
import { createState, handleRpc, type TransportState } from './transport/mcp.js';
|
|
5
|
+
/** Sentinel: the command keeps the process alive (stdio loop) — caller must not exit. */
|
|
6
|
+
export declare const KEEP_ALIVE = -1;
|
|
7
|
+
export declare function main(argv: string[]): number;
|
|
8
|
+
interface HubFetchResult {
|
|
9
|
+
ok: boolean;
|
|
10
|
+
status: number;
|
|
11
|
+
body: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/** Injectable for tests; production hits the central hub over HTTP. */
|
|
14
|
+
export type HubFetch = (url: string, init?: {
|
|
15
|
+
method?: string;
|
|
16
|
+
body?: string;
|
|
17
|
+
}) => Promise<HubFetchResult>;
|
|
18
|
+
/** Exported for tests: hub-to-hub sync roundtrip (ADR-0012). */
|
|
19
|
+
export declare function hubSync(root: string, sub: string, central: string, since?: string, fetchImpl?: HubFetch): Promise<{
|
|
20
|
+
ok: boolean;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
export interface PublishTransport {
|
|
24
|
+
(url: string, init: {
|
|
25
|
+
method: string;
|
|
26
|
+
headers: Record<string, string>;
|
|
27
|
+
body: string;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
ok: boolean;
|
|
30
|
+
status: number;
|
|
31
|
+
body: string;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
/** Exported for tests: ADR-0015 publish with a definable outbound API. */
|
|
35
|
+
export declare function publishCommand(root: string, ids: string[], transport?: PublishTransport): Promise<{
|
|
36
|
+
ok: boolean;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}>;
|
|
39
|
+
/** ADR-0011: the hub root IS a git repository — sync delegates to git. */
|
|
40
|
+
/** Exported for tests: git-backed center sync (ADR-0013). */
|
|
41
|
+
export declare function syncCommand(root: string, sub: string, remote?: string, message?: string, branch?: string): {
|
|
42
|
+
ok: boolean;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
};
|
|
45
|
+
export { createState, handleRpc, type TransportState, readHubConfig, readLedger, registerWorkspace, LEDGER_FILE };
|