agent-journal 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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +140 -0
  3. package/dist/index.js +1952 -0
  4. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anees Iqbal
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 ADDED
@@ -0,0 +1,140 @@
1
+ # agent-journal
2
+
3
+ Persistent knowledge base & journal for coding agents.
4
+
5
+ `agent-journal` is an MCP server that gives coding agents a local,
6
+ project-scoped knowledge base and journal. Knowledge is stored as immutable,
7
+ confidence-tracked statements attached to entities; journal entries record what
8
+ was done and what was proven.
9
+
10
+ ## Setup
11
+
12
+ First run may download native/prebuilt dependencies and the embedding model.
13
+
14
+ ## Claude Code
15
+
16
+ ```sh
17
+ claude mcp add agent-journal -- npx -y agent-journal --mcp
18
+ ```
19
+
20
+ ## Codex
21
+
22
+ ```sh
23
+ codex mcp add agent-journal -- npx -y agent-journal --mcp
24
+ ```
25
+
26
+ ## MCP config file
27
+
28
+ Most MCP clients read a JSON config (commonly `.mcp.json`). The server entry is
29
+ the same regardless of client:
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "agent-journal": {
35
+ "command": "npx",
36
+ "args": ["-y", "agent-journal", "--mcp"]
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## AGENTS.md / CLAUDE.md
43
+
44
+ Add this line to the project instructions file so the coding agent knows to pay
45
+ attention to the MCP server and use its guide when needed:
46
+
47
+ ```md
48
+ This project has an `agent-journal` MCP server providing a persistent knowledge base + journal. Its usage is self-described on connect; call `memory.guide` for the full playbook.
49
+ ```
50
+
51
+ The server also returns this same text from `memory.agents_md_snippet`.
52
+
53
+ ## Storage
54
+
55
+ The server stores data in `memory.db` under the app config directory by default.
56
+ Set `AGENT_JOURNAL_DB=/path/to/memory.db` to override the database path.
57
+
58
+ The app config directory is:
59
+
60
+ 1. `$XDG_CONFIG_DIR/agent-memory` when `XDG_CONFIG_DIR` is set.
61
+ 2. `$XDG_CONFIG_HOME/agent-memory` when `XDG_CONFIG_HOME` is set.
62
+ 3. `~/.config/agent-memory` otherwise.
63
+
64
+ Project config files live beside the database as
65
+ `project_<sha256(repo-key)>.json`. The embedding model cache is stored in that
66
+ same app config directory.
67
+
68
+ ## Project Identity
69
+
70
+ The server resolves project identity from, in order:
71
+
72
+ 1. A tool call `project` override.
73
+ 2. A per-repo config file in the app config directory.
74
+ 3. Normalized `git remote origin` URL.
75
+ 4. Main worktree path.
76
+ 5. Absolute current working directory when outside git.
77
+
78
+ To create a per-repo config file, first determine the repo key the server would
79
+ use: normalized origin URL when available, otherwise the main worktree path.
80
+ Then hash it with SHA-256 and write:
81
+
82
+ ```json
83
+ {
84
+ "project": "github.com/acme/widgets",
85
+ "config": {
86
+ "tombstone_window": "180d"
87
+ }
88
+ }
89
+ ```
90
+
91
+ to:
92
+
93
+ ```text
94
+ ~/.config/agent-memory/project_<sha256(repo-key)>.json
95
+ ```
96
+
97
+ Worktrees share the same project key through the main git directory.
98
+
99
+ ## Tools
100
+
101
+ The v0 server exposes:
102
+
103
+ - `memory.search`
104
+ - `memory.get`
105
+ - `memory.recent`
106
+ - `memory.stats`
107
+ - `memory.guide`
108
+ - `memory.agents_md_snippet`
109
+ - `kb.upsert_entity`
110
+ - `kb.add_statement`
111
+ - `kb.edit_statement`
112
+ - `kb.invalidate`
113
+ - `kb.delete`
114
+ - `journal.append`
115
+
116
+ Use `memory.guide` for the full operating playbook. In short: search before
117
+ acting, write atomic statements with honest confidence/provenance, journal what
118
+ you did, use immutable edits/invalidation for stale facts, and reserve
119
+ `kb.delete` for poisoned content such as secrets or PII.
120
+
121
+ ## Development
122
+
123
+ ```sh
124
+ npm install
125
+ npm run format
126
+ npm run typecheck
127
+ npm test
128
+ npm run build
129
+ ```
130
+
131
+ The unit tests use deterministic stub embeddings and do not download the model.
132
+ Run the opt-in real embedding integration test with:
133
+
134
+ ```sh
135
+ AGENT_JOURNAL_REAL_EMBEDDINGS=1 npm test
136
+ ```
137
+
138
+ ## License
139
+
140
+ [MIT](LICENSE) © Anees Iqbal