@contextline/contextline 0.1.1 → 0.2.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/README.md CHANGED
@@ -1,178 +1,154 @@
1
- # ContextLine
2
-
3
- ContextLine is a local-first, filesystem-backed memory layer for MCP-capable AI assistants.
4
-
5
- It gives an assistant a small quick-memory file, links into deeper Markdown memory files, and a single MCP tool for reading and writing memory. The server stores and retrieves files; the host model decides what is worth remembering.
6
-
7
- For product context and examples, see [Why ContextLine Exists](docs/why-contextline.md).
8
-
9
- ## Install
10
-
11
- ```sh
12
- npm install -g contextline
13
- contextline setup
14
- ```
15
-
16
- The install step prints a reminder to run `contextline setup`. Setup is explicit because it creates local memory files and host integration config.
17
-
18
- ## Quick Start With Codex
19
-
20
- From the project where you want memory enabled:
21
-
22
- ```sh
23
- contextline setup
24
- codex
25
- ```
26
-
27
- By default, setup stores memory in `./.contextline`, detects supported hosts, and configures Codex when available.
28
-
29
- Setup creates:
30
-
31
- - `.contextline/` for local memory
32
- - `.codex/hooks.json` for the Codex `SessionStart` hook
33
- - `.codex/hooks/contextline-hook.mjs` for the hook command
34
- - `.codex/config.toml` for the ContextLine MCP server
35
-
36
- On session start, Codex gets a short instruction to call the `contextline` MCP tool with action `hydrate`. The returned instructions tell the main session how to use quick memory and periodically save durable memory.
37
-
38
- ## What Gets Stored
39
-
40
- ContextLine writes plain Markdown:
41
-
42
- ```text
43
- .contextline/
44
- L1_Quick.md
45
- L2_Deep/
46
- person_user.md
47
- project_contextline.md
48
- area_work.md
49
- preference_media.md
50
- L3_Details/
51
- L3_2026_05.md
52
- maintenance/
53
- proposals/
54
- contextline_instructions.md
55
- config.json
56
- ```
57
-
58
- The cache model is:
59
-
60
- - `L1_Quick.md`: compact facts, summaries, and active pointers.
61
- - `L2_Deep/`: richer fact files per important person, object, project, place, preference area, event, or decision thread.
62
- - `L3_Details/`: timestamped specifics, receipts, and supporting history.
63
-
64
- V1 uses flat L2 filenames with semantic prefixes, such as `person_`, `project_`, `area_`, `place_`, `preference_`, `decision_`, `event_`, and `org_`.
65
-
66
- Topology rules:
67
-
68
- - L1 may link only to L2 files.
69
- - L2 may link only to L3 detail files.
70
- - L3 files are terminal detail files and must contain no wiki links.
71
- - L1 memory lines should link to relevant L2 files.
72
- - L2 memory lines should link to relevant L3 detail files when supporting detail exists.
73
-
74
- ## CLI
75
-
76
- ```sh
77
- contextline setup [--host codex|auto|none] [--root .contextline]
78
- contextline init [root]
79
- contextline hydrate [root]
80
- contextline validate [root]
81
- contextline inspect [root]
82
- contextline append "text" --date 2026-05-24 [root]
83
- contextline update-deep <file> <fact-text> <detail-file> [root]
84
- contextline update-index <index-line> <files...> --root <root>
85
- contextline hook --root <root>
86
- ```
87
-
88
- ## MCP Tool
89
-
90
- The V1 MCP surface exposes one tool:
91
-
92
- - `contextline`
93
-
94
- Use the `action` field for operations:
95
-
96
- - `hydrate`
97
- - `read_deep`
98
- - `read_details`
99
- - `save_memory`
100
- - `validate`
101
- - `inspect`
102
- - `append_detail`
103
- - `update_deep`
104
- - `update_index`
105
- - `propose_compaction`
106
-
107
- The broad tool shape keeps host approval UX simple. The `save_memory` action bundles the full write chain: append L3 detail, update relevant L2 files, update L1 quick memory, then validate topology.
108
-
109
- Manual MCP config:
110
-
111
- ```json
112
- {
113
- "mcpServers": {
114
- "contextline": {
115
- "command": "contextline-mcp",
116
- "args": [],
117
- "env": {
118
- "CONTEXTLINE_ROOT": "/path/to/project/.contextline"
119
- }
120
- }
121
- }
122
- }
123
- ```
124
-
125
- ## Privacy
126
-
127
- ContextLine stores memory in local files under the folder you choose. It does not upload memory or run semantic extraction inside the server. The host assistant decides what to save and calls the local MCP tool.
128
-
129
- ## Development
130
-
131
- ```sh
132
- npm install
133
- npm run build
134
- npm test
135
- ```
136
-
137
- To test the CLI locally:
138
-
139
- ```sh
140
- npm link
141
- contextline setup
142
- ```
143
-
144
- If auto-detection fails, or if you want a different memory folder:
145
-
146
- ```sh
147
- contextline setup --host codex --root .contextline
148
- ```
149
-
150
- To inspect the npm package contents before publishing:
151
-
152
- ```sh
153
- npm pack --dry-run
154
- ```
155
-
156
- ## Publishing
157
-
158
- Before publishing:
159
-
160
- ```sh
161
- npm run build
162
- npm test
163
- npm pack --dry-run
164
- ```
165
-
166
- Then publish:
167
-
168
- ```sh
169
- npm publish --access public
170
- git tag v0.1.0
171
- git push origin main --tags
172
- ```
173
-
174
- ## Limitations
175
-
176
- V1 intentionally excludes embeddings, vector search, cloud sync, databases, GUI, telemetry upload, team sharing, and automatic semantic classification inside the server.
177
-
178
- Currently supported host setup is Codex. Other MCP-capable hosts can use manual MCP configuration.
1
+ # ContextLine
2
+
3
+ ContextLine is a local-first, filesystem-backed memory layer for AI assistants.
4
+
5
+ It gives an assistant a small quick-memory file, links into deeper Markdown memory files, and checkpoint instructions for saving durable memory. The host model decides what is worth remembering and writes normal Markdown files.
6
+
7
+ For product context and examples, see [Why ContextLine Exists](docs/why-contextline.md).
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install -g @contextline/contextline
13
+ contextline setup
14
+ ```
15
+
16
+ The install step prints a reminder to run `contextline setup`. Setup is explicit because it creates local memory files and host integration config.
17
+
18
+ ## Quick Start With Codex Or Claude Code
19
+
20
+ From the project where you want memory enabled:
21
+
22
+ ```sh
23
+ contextline setup
24
+ codex
25
+ # or
26
+ claude
27
+ ```
28
+
29
+ By default, setup stores memory in `./.contextline`, detects supported hosts, and configures Codex and Claude Code when available.
30
+
31
+ Setup creates:
32
+
33
+ - `.contextline/` for local memory
34
+ - `.codex/hooks.json` for the Codex `SessionStart` and `UserPromptSubmit` hooks
35
+ - `.codex/hooks/contextline-hook.mjs` for the hook command
36
+ - `.codex/config.toml` for a filesystem MCP server scoped to `.contextline/`
37
+ - `.claude/settings.json` for the Claude Code `SessionStart` and `UserPromptSubmit` hooks
38
+ - `.claude/hooks/contextline-hook.mjs` for the hook command
39
+
40
+ On session start, the host gets a bounded memory snapshot from `L1_Quick.md`. On each user prompt, the host gets a checkpoint instruction to save durable memory from the previous exchange when the exchange was not purely transient.
41
+
42
+ ## What Gets Stored
43
+
44
+ ContextLine writes plain Markdown:
45
+
46
+ ```text
47
+ .contextline/
48
+ L1_Quick.md
49
+ L2_Deep/
50
+ person_customer.md
51
+ project_contextline.md
52
+ area_work.md
53
+ preference_media.md
54
+ maintenance/
55
+ proposals/
56
+ contextline_instructions.md
57
+ config.json
58
+ ```
59
+
60
+ The cache model is:
61
+
62
+ - `L1_Quick.md`: compact facts, summaries, and active pointers.
63
+ - `L2_Deep/`: dated durable memory files per important person, object, project, place, preference area, event, or decision thread. L2 entries include the relevant discussion context directly.
64
+
65
+ V1 uses flat L2 filenames with semantic prefixes, such as `person_`, `project_`, `area_`, `place_`, `preference_`, `decision_`, `event_`, and `org_`.
66
+
67
+ Topology rules:
68
+
69
+ - L1 may link only to L2 files.
70
+ - L1 memory lines should link to relevant L2 files.
71
+ - L2 memory lines should be dated and should generally not contain wiki links.
72
+
73
+ ## CLI
74
+
75
+ ```sh
76
+ contextline setup [--host codex|claude|claude-code|auto|none] [--root .contextline]
77
+ contextline hook --root <root>
78
+ ```
79
+
80
+ ## Host Integration
81
+
82
+ ContextLine does not run a custom MCP server. It installs hooks that provide the assistant with:
83
+
84
+ - session-start memory hydration from `L1_Quick.md`
85
+ - per-prompt checkpoint instructions for saving durable memory
86
+ - a local `.contextline/` file structure
87
+
88
+ Codex setup also registers `@modelcontextprotocol/server-filesystem`, scoped only to the `.contextline/` folder, so Codex can use file tools for memory reads and writes. Claude Code uses its native file tools plus project permissions for `.contextline/**`.
89
+
90
+ Manual Codex filesystem MCP config:
91
+
92
+ ```toml
93
+ [mcp_servers.filesystem]
94
+ type = "stdio"
95
+ command = "npx"
96
+ args = ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project/.contextline"]
97
+ startup_timeout_sec = 10
98
+ tool_timeout_sec = 10
99
+ ```
100
+
101
+ ## Privacy
102
+
103
+ ContextLine stores memory in local files under the folder you choose. It does not upload memory or run semantic extraction in a server. The host assistant decides what to save and edits the local Markdown files.
104
+
105
+ ## Development
106
+
107
+ ```sh
108
+ npm install
109
+ npm run build
110
+ npm test
111
+ ```
112
+
113
+ To test the CLI locally:
114
+
115
+ ```sh
116
+ npm install -g .
117
+ contextline setup
118
+ ```
119
+
120
+ If auto-detection fails, or if you want a different memory folder:
121
+
122
+ ```sh
123
+ contextline setup --host claude --root .contextline
124
+ ```
125
+
126
+ To inspect the npm package contents before publishing:
127
+
128
+ ```sh
129
+ npm pack --dry-run
130
+ ```
131
+
132
+ ## Publishing
133
+
134
+ Before publishing:
135
+
136
+ ```sh
137
+ npm run build
138
+ npm test
139
+ npm pack --dry-run
140
+ ```
141
+
142
+ Then publish:
143
+
144
+ ```sh
145
+ npm publish --access public
146
+ git tag v0.2.0
147
+ git push origin main --tags
148
+ ```
149
+
150
+ ## Limitations
151
+
152
+ V1 intentionally excludes embeddings, vector search, cloud sync, databases, GUI, telemetry upload, team sharing, and automatic semantic classification.
153
+
154
+ Currently supported host setup is Codex and Claude Code.