@suwujs/codex-vault 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 +174 -0
- package/README.zh-CN.md +155 -0
- package/bin/cli.js +90 -0
- package/package.json +29 -0
- package/plugin/VERSION +1 -0
- package/plugin/hooks/classify-message.py +240 -0
- package/plugin/hooks/session-start.sh +176 -0
- package/plugin/hooks/validate-write.py +113 -0
- package/plugin/install.sh +350 -0
- package/plugin/instructions.md +118 -0
- package/plugin/skills/dump.md +29 -0
- package/plugin/skills/ingest.md +63 -0
- package/plugin/skills/recall.md +54 -0
- package/plugin/skills/wrap-up.md +35 -0
- package/vault/.claude/settings.json +39 -0
- package/vault/.claude/skills/dump/SKILL.md +29 -0
- package/vault/.claude/skills/ingest/SKILL.md +63 -0
- package/vault/.claude/skills/recall/SKILL.md +54 -0
- package/vault/.claude/skills/wrap-up/SKILL.md +35 -0
- package/vault/.codex/config.toml +2 -0
- package/vault/.codex/hooks.json +39 -0
- package/vault/.codex/skills/dump/SKILL.md +29 -0
- package/vault/.codex/skills/ingest/SKILL.md +63 -0
- package/vault/.codex/skills/recall/SKILL.md +54 -0
- package/vault/.codex/skills/wrap-up/SKILL.md +35 -0
- package/vault/.codex-vault/hooks/classify-message.py +240 -0
- package/vault/.codex-vault/hooks/session-start.sh +176 -0
- package/vault/.codex-vault/hooks/validate-write.py +113 -0
- package/vault/AGENTS.md +118 -0
- package/vault/CLAUDE.md +118 -0
- package/vault/Home.md +21 -0
- package/vault/brain/Key Decisions.md +11 -0
- package/vault/brain/Memories.md +19 -0
- package/vault/brain/North Star.md +29 -0
- package/vault/brain/Patterns.md +11 -0
- package/vault/log.md +15 -0
- package/vault/reference/.gitkeep +0 -0
- package/vault/sources/.gitkeep +0 -0
- package/vault/sources/README.md +19 -0
- package/vault/templates/Decision Record.md +29 -0
- package/vault/templates/Reference Note.md +25 -0
- package/vault/templates/Source Summary.md +25 -0
- package/vault/templates/Thinking Note.md +26 -0
- package/vault/templates/Work Note.md +25 -0
- package/vault/work/Index.md +35 -0
- package/vault/work/active/.gitkeep +0 -0
- package/vault/work/archive/.gitkeep +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fayon
|
|
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,174 @@
|
|
|
1
|
+
# Codex-Vault
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
> A knowledge vault that works with any LLM agent.
|
|
6
|
+
> Your notes, your git, your data.
|
|
7
|
+
|
|
8
|
+
## The Problem
|
|
9
|
+
|
|
10
|
+
LLM agents forget everything between sessions. You re-explain the same context, lose decisions made three conversations ago, and the knowledge never compounds.
|
|
11
|
+
|
|
12
|
+
## The Solution
|
|
13
|
+
|
|
14
|
+
A structured vault + 3 hooks that give your agent persistent memory. Works with **Claude Code** and **Codex CLI**. Just markdown and git.
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
You: "start session"
|
|
18
|
+
Agent: *reads North Star, checks active projects, scans recent changes*
|
|
19
|
+
Agent: "You're working on the API redesign. Last session you decided
|
|
20
|
+
to split the coordinator pattern. There's an open question
|
|
21
|
+
about error handling."
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 30-Second Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# From your project directory:
|
|
28
|
+
git clone https://github.com/sukbearai/codex-vault.git /tmp/codex-vault
|
|
29
|
+
bash /tmp/codex-vault/plugin/install.sh # integrated mode — installs vault + hooks into your project
|
|
30
|
+
claude # or: codex
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Fill in `vault/brain/North Star.md` with your goals, then start talking.
|
|
34
|
+
|
|
35
|
+
> **Standalone mode**: run `install.sh` from inside the codex-vault repo itself to use `vault/` as the working directory.
|
|
36
|
+
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
You speak
|
|
41
|
+
|
|
|
42
|
+
v
|
|
43
|
+
classify hook (categorizes: decision? win? project update?)
|
|
44
|
+
|
|
|
45
|
+
v
|
|
46
|
+
Agent writes notes (guided by instructions.md)
|
|
47
|
+
|
|
|
48
|
+
v
|
|
49
|
+
validate hook (checks: frontmatter? wikilinks? correct folder?)
|
|
50
|
+
|
|
|
51
|
+
v
|
|
52
|
+
git commit (persistent)
|
|
53
|
+
|
|
|
54
|
+
v
|
|
55
|
+
Next session → session-start hook injects context back
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Three hooks power the loop:
|
|
59
|
+
|
|
60
|
+
| Hook | When | What |
|
|
61
|
+
|------|------|------|
|
|
62
|
+
| **session-start** | Agent starts | Injects North Star goals, recent git changes, active work, vault file listing |
|
|
63
|
+
| **classify-message** | Every message | Detects decisions, wins, project updates — hints the agent where to file them |
|
|
64
|
+
| **validate-write** | After writing `.md` | Checks frontmatter and wikilinks — catches mistakes before they stick |
|
|
65
|
+
|
|
66
|
+
## Supported Agents
|
|
67
|
+
|
|
68
|
+
| Agent | Hooks | Skills | Status |
|
|
69
|
+
|-------|-------|--------|--------|
|
|
70
|
+
| Claude Code | 3 hooks via `.claude/settings.json` | `/dump` `/recall` `/ingest` `/wrap-up` | Full support |
|
|
71
|
+
| Codex CLI | 3 hooks via `.codex/hooks.json` | `$dump` `$recall` `$ingest` `$wrap-up` | Full support |
|
|
72
|
+
| Other | Write an adapter ([docs/adding-an-agent.md](docs/adding-an-agent.md)) | Depends on agent | Community |
|
|
73
|
+
|
|
74
|
+
## Vault Structure
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
vault/
|
|
78
|
+
Home.md Entry point — current focus, quick links
|
|
79
|
+
log.md Append-only operation log — grep-parseable
|
|
80
|
+
brain/
|
|
81
|
+
North Star.md Goals and focus — read every session
|
|
82
|
+
Memories.md Memory index
|
|
83
|
+
Key Decisions.md Decisions worth recalling
|
|
84
|
+
Patterns.md Recurring patterns
|
|
85
|
+
work/
|
|
86
|
+
Index.md Map of all work notes
|
|
87
|
+
active/ Current projects
|
|
88
|
+
archive/ Completed work
|
|
89
|
+
templates/ Note templates (Work Note, Decision Record, Thinking Note)
|
|
90
|
+
thinking/ Scratchpad — promote findings, then delete
|
|
91
|
+
sources/ Raw source documents — immutable, LLM reads only
|
|
92
|
+
reference/ Saved answers and analyses from query writeback
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Eight folders. Five note types. That's it.
|
|
96
|
+
|
|
97
|
+
## Skills
|
|
98
|
+
|
|
99
|
+
User-invoked skills — the agent suggests them, but only executes when you explicitly run one:
|
|
100
|
+
|
|
101
|
+
| Skill | What It Does |
|
|
102
|
+
|-------|-------------|
|
|
103
|
+
| `/dump` | Freeform capture — say anything, agent classifies and routes to the right notes |
|
|
104
|
+
| `/wrap-up` | End-of-session review — verify notes, update indexes, check links |
|
|
105
|
+
| `/ingest` | Process a source document into wiki pages with cross-links |
|
|
106
|
+
| `/recall` | On-demand memory retrieval — search the vault for a topic and synthesize |
|
|
107
|
+
|
|
108
|
+
The classify hook detects intent (decision, win, project update, query, ingest) and suggests the right skill. You decide whether to run it — the agent never auto-writes vault notes.
|
|
109
|
+
|
|
110
|
+
Claude Code uses `/skill-name`, Codex CLI uses `$skill-name`. Both read from their respective `.claude/skills/` and `.codex/skills/` directories.
|
|
111
|
+
|
|
112
|
+
### Prompt Templates
|
|
113
|
+
|
|
114
|
+
Copy-paste ready — replace `<>` with your content:
|
|
115
|
+
|
|
116
|
+
**`/dump`**
|
|
117
|
+
```
|
|
118
|
+
/dump We decided to use <option A> over <option B> because <reason>
|
|
119
|
+
/dump <project> is done. Key outcome: <what was achieved>
|
|
120
|
+
/dump Pattern noticed: <description>
|
|
121
|
+
/dump Remember: <anything you want the agent to recall next session>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**`/recall`**
|
|
125
|
+
```
|
|
126
|
+
/recall <keyword>
|
|
127
|
+
/recall how did we decide on <topic>
|
|
128
|
+
/recall <project> progress
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**`/ingest`**
|
|
132
|
+
```
|
|
133
|
+
/ingest <URL>
|
|
134
|
+
/ingest sources/<filename>.md
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**`/wrap-up`** — no arguments needed, the agent scans the session automatically.
|
|
138
|
+
|
|
139
|
+
## Usage Scenarios
|
|
140
|
+
|
|
141
|
+
See [docs/usage.md](docs/usage.md) — 7 real scenarios from first session to project completion, with exact commands and expected output.
|
|
142
|
+
|
|
143
|
+
## Design Principles
|
|
144
|
+
|
|
145
|
+
1. **Data sovereignty** — your markdown, your git, your machine. No cloud lock-in.
|
|
146
|
+
2. **Agent-agnostic** — hooks are the universal interface. One vault, multiple agents.
|
|
147
|
+
3. **Minimal by default** — 3 hooks, ~100 lines of instructions. Add complexity only when needed.
|
|
148
|
+
4. **Graph-first** — folders group by purpose, [[wikilinks]] group by meaning. Links are the primary organization tool.
|
|
149
|
+
5. **Future-proof** — if models get built-in memory, the vault still has value as auditable, portable, git-tracked local storage.
|
|
150
|
+
|
|
151
|
+
## Customization
|
|
152
|
+
|
|
153
|
+
| What | How |
|
|
154
|
+
|------|-----|
|
|
155
|
+
| Your goals | Edit `brain/North Star.md` |
|
|
156
|
+
| New note types | Add templates to `templates/`, update `plugin/instructions.md` |
|
|
157
|
+
| More signals | Add patterns to `plugin/hooks/classify-message.py` |
|
|
158
|
+
| New agent | Add hooks and skills in `plugin/` ([guide](docs/adding-an-agent.md)) |
|
|
159
|
+
|
|
160
|
+
## Requirements
|
|
161
|
+
|
|
162
|
+
- Git
|
|
163
|
+
- Python 3
|
|
164
|
+
- One of: [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Codex CLI](https://github.com/openai/codex)
|
|
165
|
+
- Optional: [Obsidian](https://obsidian.md) (for graph view, backlinks, visual browsing)
|
|
166
|
+
|
|
167
|
+
## Inspired By
|
|
168
|
+
|
|
169
|
+
- [llm-wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) by Karpathy — the pattern
|
|
170
|
+
- [obsidian-mind](https://github.com/sukbearai/obsidian-mind) — full-featured implementation for engineer performance tracking
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Codex-Vault
|
|
2
|
+
|
|
3
|
+
> 给任何 LLM agent 加上持久记忆。
|
|
4
|
+
> 你的笔记,你的 git,你的数据。
|
|
5
|
+
|
|
6
|
+
## 问题
|
|
7
|
+
|
|
8
|
+
LLM agent 每次对话都从零开始。上次做的决策忘了,讨论过的方案忘了,知识永远无法积累。
|
|
9
|
+
|
|
10
|
+
## 方案
|
|
11
|
+
|
|
12
|
+
一个结构化的知识库 + 3 个 hook,让 agent 拥有跨 session 的记忆。支持 **Claude Code** 和 **Codex CLI**。纯 markdown + git,没有外部依赖。
|
|
13
|
+
|
|
14
|
+
## 核心用法
|
|
15
|
+
|
|
16
|
+
5 个动作,覆盖日常全部场景:
|
|
17
|
+
|
|
18
|
+
| 动作 | 怎么做 | 什么时候用 |
|
|
19
|
+
|------|--------|-----------|
|
|
20
|
+
| **设目标** | 编辑 `brain/North Star.md` | 首次使用,或方向调整时 |
|
|
21
|
+
| **随手记** | `/dump 内容` | 做了决策、有了想法、完成了什么 — 随时 dump |
|
|
22
|
+
| **查记忆** | `/recall 关键词` | 忘了之前的决策、想找历史笔记 |
|
|
23
|
+
| **吃内容** | `/ingest URL或文件` | 看到好文章、拿到新资料,结构化存入 |
|
|
24
|
+
| **收尾** | `/wrap-up` | session 结束前,检查质量、更新索引 |
|
|
25
|
+
|
|
26
|
+
> Codex CLI 用 `$dump`、`$recall`、`$ingest`、`$wrap-up`。
|
|
27
|
+
|
|
28
|
+
### 提示词模板
|
|
29
|
+
|
|
30
|
+
直接复制使用,替换 `<>` 里的内容:
|
|
31
|
+
|
|
32
|
+
**`/dump` — 随手记**
|
|
33
|
+
```
|
|
34
|
+
/dump 我们决定用 <方案A> 而不是 <方案B>,因为 <原因>
|
|
35
|
+
/dump <项目名> 完成了,关键成果:<成果描述>
|
|
36
|
+
/dump 今天发现一个规律:<规律描述>
|
|
37
|
+
/dump 记住:<任何你想让 agent 下次记得的事>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**`/recall` — 查记忆**
|
|
41
|
+
```
|
|
42
|
+
/recall <关键词>
|
|
43
|
+
/recall 我们之前怎么决定的 <某件事>
|
|
44
|
+
/recall <项目名> 的进展
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**`/ingest` — 吃内容**
|
|
48
|
+
```
|
|
49
|
+
/ingest <URL>
|
|
50
|
+
/ingest sources/<文件名>.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**`/wrap-up` — 收尾**
|
|
54
|
+
```
|
|
55
|
+
/wrap-up
|
|
56
|
+
```
|
|
57
|
+
> 不需要参数,agent 自动扫描本次 session 的变更。
|
|
58
|
+
|
|
59
|
+
日常最高频的就是 `/dump`。其他按需使用。
|
|
60
|
+
|
|
61
|
+
## 30 秒上手
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# 在你的项目目录下:
|
|
65
|
+
git clone https://github.com/sukbearai/codex-vault.git /tmp/codex-vault
|
|
66
|
+
bash /tmp/codex-vault/plugin/install.sh # 集成模式 — 自动安装 vault + hooks
|
|
67
|
+
claude # 或: codex
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
填好 `vault/brain/North Star.md`,开始对话。
|
|
71
|
+
|
|
72
|
+
> **独立模式**:在 codex-vault 仓库内运行 `install.sh`,以 `vault/` 为工作目录。
|
|
73
|
+
|
|
74
|
+
## 工作原理
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
你说话
|
|
78
|
+
↓
|
|
79
|
+
classify hook(分类:决策?进展?想法?)
|
|
80
|
+
↓
|
|
81
|
+
Agent 写笔记(按 instructions.md 规范)
|
|
82
|
+
↓
|
|
83
|
+
validate hook(检查:frontmatter?wikilinks?正确目录?)
|
|
84
|
+
↓
|
|
85
|
+
git commit(持久化)
|
|
86
|
+
↓
|
|
87
|
+
下次 session → session-start hook 注入上下文
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
三个 hook 驱动整个循环:
|
|
91
|
+
|
|
92
|
+
| Hook | 触发时机 | 做什么 |
|
|
93
|
+
|------|---------|--------|
|
|
94
|
+
| **session-start** | Agent 启动 | 注入 North Star 目标、近期 git 变更、活跃项目、vault 文件清单 |
|
|
95
|
+
| **classify-message** | 每条消息 | 检测决策、成果、项目更新 — 提示 agent 该归档到哪里 |
|
|
96
|
+
| **validate-write** | 写 `.md` 后 | 检查 frontmatter 和 wikilinks — 在落盘前纠错 |
|
|
97
|
+
|
|
98
|
+
## 支持的 Agent
|
|
99
|
+
|
|
100
|
+
| Agent | Hooks | Skills | 状态 |
|
|
101
|
+
|-------|-------|--------|------|
|
|
102
|
+
| Claude Code | `.claude/settings.json` 3 hooks | `/dump` `/recall` `/ingest` `/wrap-up` | 完整支持 |
|
|
103
|
+
| Codex CLI | `.codex/hooks.json` 3 hooks | `$dump` `$recall` `$ingest` `$wrap-up` | 完整支持 |
|
|
104
|
+
| 其他 | 写适配器([指南](docs/adding-an-agent.md)) | 取决于 agent | 社区贡献 |
|
|
105
|
+
|
|
106
|
+
## Vault 结构
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
vault/
|
|
110
|
+
Home.md 入口 — 当前焦点、快速链接
|
|
111
|
+
log.md 操作日志(append-only)
|
|
112
|
+
brain/
|
|
113
|
+
North Star.md 目标和方向 — 每次 session 自动读取
|
|
114
|
+
Memories.md 记忆索引
|
|
115
|
+
Key Decisions.md 值得跨 session 记住的决策
|
|
116
|
+
Patterns.md 反复出现的规律
|
|
117
|
+
work/
|
|
118
|
+
Index.md 所有工作笔记的索引
|
|
119
|
+
active/ 进行中的项目
|
|
120
|
+
archive/ 已完成的项目
|
|
121
|
+
templates/ 笔记模板
|
|
122
|
+
thinking/ 草稿区 — 想清楚后归档,然后删除
|
|
123
|
+
sources/ 原始资料 — 不可修改,agent 只读
|
|
124
|
+
reference/ 问答回写 — 有价值的综合分析
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
八个目录,五种笔记类型。
|
|
128
|
+
|
|
129
|
+
## 使用场景
|
|
130
|
+
|
|
131
|
+
详见 [docs/usage.md](docs/usage.md) — 7 个真实场景,从首次安装到项目完成,每一步都有输入和输出示例。
|
|
132
|
+
|
|
133
|
+
## 设计原则
|
|
134
|
+
|
|
135
|
+
1. **数据主权** — 你的 markdown,你的 git,你的机器。没有云端锁定。
|
|
136
|
+
2. **Agent 无关** — hook 是通用接口。一个 vault,多个 agent。
|
|
137
|
+
3. **默认极简** — 3 个 hook,~100 行指令。按需增加复杂度。
|
|
138
|
+
4. **图优先** — 目录按用途分组,`[[wikilinks]]` 按语义分组。链接是主要的组织工具。
|
|
139
|
+
5. **面向未来** — 即使模型有了内建记忆,vault 仍然有价值:可审计、可迁移、git 追踪的本地存储。
|
|
140
|
+
|
|
141
|
+
## 依赖
|
|
142
|
+
|
|
143
|
+
- Git
|
|
144
|
+
- Python 3
|
|
145
|
+
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 或 [Codex CLI](https://github.com/openai/codex)(二选一)
|
|
146
|
+
- 可选:[Obsidian](https://obsidian.md)(图谱视图、反向链接、可视化浏览)
|
|
147
|
+
|
|
148
|
+
## 灵感来源
|
|
149
|
+
|
|
150
|
+
- [llm-wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) by Karpathy — 这个模式的起源
|
|
151
|
+
- [obsidian-mind](https://github.com/sukbearai/obsidian-mind) — 面向工程师效能追踪的完整实现
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require('child_process');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
const PKG_ROOT = path.resolve(__dirname, '..');
|
|
9
|
+
const INSTALL_SH = path.join(PKG_ROOT, 'plugin', 'install.sh');
|
|
10
|
+
const VERSION = fs.readFileSync(path.join(PKG_ROOT, 'plugin', 'VERSION'), 'utf8').trim();
|
|
11
|
+
|
|
12
|
+
const args = process.argv.slice(2);
|
|
13
|
+
const cmd = args[0] || 'init';
|
|
14
|
+
|
|
15
|
+
switch (cmd) {
|
|
16
|
+
case '--version':
|
|
17
|
+
case '-v':
|
|
18
|
+
console.log(VERSION);
|
|
19
|
+
break;
|
|
20
|
+
|
|
21
|
+
case '--help':
|
|
22
|
+
case '-h':
|
|
23
|
+
printHelp();
|
|
24
|
+
break;
|
|
25
|
+
|
|
26
|
+
case 'init':
|
|
27
|
+
runInit();
|
|
28
|
+
break;
|
|
29
|
+
|
|
30
|
+
case 'upgrade':
|
|
31
|
+
case 'uninstall':
|
|
32
|
+
console.log(`"${cmd}" is coming in v0.2.0.`);
|
|
33
|
+
break;
|
|
34
|
+
|
|
35
|
+
default:
|
|
36
|
+
console.error(`Unknown command: ${cmd}\n`);
|
|
37
|
+
printHelp();
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function printHelp() {
|
|
42
|
+
console.log(`codex-vault v${VERSION}
|
|
43
|
+
|
|
44
|
+
Usage:
|
|
45
|
+
codex-vault init Install vault into current directory (default)
|
|
46
|
+
codex-vault upgrade Upgrade vault (coming in v0.2.0)
|
|
47
|
+
codex-vault uninstall Remove vault (coming in v0.2.0)
|
|
48
|
+
codex-vault -v, --version Print version
|
|
49
|
+
codex-vault -h, --help Print this help`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function runInit() {
|
|
53
|
+
// Check bash availability
|
|
54
|
+
const bashCheck = spawnSync('bash', ['--version'], { stdio: 'ignore' });
|
|
55
|
+
if (bashCheck.error) {
|
|
56
|
+
console.error('Error: bash is not available.');
|
|
57
|
+
console.error('On Windows, please install Git Bash or WSL.');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Check if already installed
|
|
62
|
+
const versionFile = path.join(process.cwd(), 'vault', '.codex-vault', 'version');
|
|
63
|
+
if (fs.existsSync(versionFile)) {
|
|
64
|
+
const installed = fs.readFileSync(versionFile, 'utf8').trim();
|
|
65
|
+
console.log(`codex-vault v${installed} is already installed in this directory.`);
|
|
66
|
+
console.log('To reinstall, remove vault/.codex-vault/version first.');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Run install.sh
|
|
71
|
+
const result = spawnSync('bash', [INSTALL_SH], {
|
|
72
|
+
cwd: process.cwd(),
|
|
73
|
+
stdio: 'inherit',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (result.error) {
|
|
77
|
+
console.error('Failed to run install.sh:', result.error.message);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (result.status !== 0) {
|
|
82
|
+
process.exit(result.status);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Write version file on success
|
|
86
|
+
const versionDir = path.dirname(versionFile);
|
|
87
|
+
fs.mkdirSync(versionDir, { recursive: true });
|
|
88
|
+
fs.writeFileSync(versionFile, VERSION + '\n');
|
|
89
|
+
console.log(`\ncodex-vault v${VERSION} installed successfully.`);
|
|
90
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@suwujs/codex-vault",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Persistent knowledge vault for LLM agents (Claude Code, Codex CLI)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/sukbearai/codex-vault"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"codex-vault": "bin/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/",
|
|
15
|
+
"plugin/",
|
|
16
|
+
"vault/"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"claude-code",
|
|
23
|
+
"codex",
|
|
24
|
+
"llm",
|
|
25
|
+
"knowledge-base",
|
|
26
|
+
"obsidian",
|
|
27
|
+
"vault"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/plugin/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0
|