@suwujs/codex-vault 0.3.4 → 0.4.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 +11 -1
- package/README.zh-CN.md +15 -0
- package/package.json +1 -1
- package/plugin/VERSION +1 -1
- package/plugin/hooks/session-start.sh +32 -0
- package/vault/.codex-vault/hooks/session-start.sh +35 -3
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ User-invoked skills — the agent suggests them, but only executes when you expl
|
|
|
113
113
|
| `/ingest` | Process a source document into wiki pages with cross-links |
|
|
114
114
|
| `/recall` | On-demand memory retrieval — search the vault for a topic and synthesize |
|
|
115
115
|
|
|
116
|
-
The classify hook detects intent (decision, win, project update, query, ingest) and suggests the right skill.
|
|
116
|
+
The classify hook detects intent (decision, win, project update, query, ingest) and suggests the right skill. By default, you decide whether to run it (**suggest mode**). Set `{"classify_mode": "auto"}` in `vault/.codex-vault/config.json` to have the agent execute skills automatically (**auto mode**).
|
|
117
117
|
|
|
118
118
|
Claude Code uses `/skill-name`, Codex CLI uses `$skill-name`. Both read from their respective `.claude/skills/` and `.codex/skills/` directories.
|
|
119
119
|
|
|
@@ -163,12 +163,22 @@ See [docs/usage.md](docs/usage.md) — 7 real scenarios from first session to pr
|
|
|
163
163
|
| Your goals | Edit `brain/North Star.md` |
|
|
164
164
|
| New note types | Add templates to `templates/`, update `plugin/instructions.md` |
|
|
165
165
|
| More signals | Add patterns to `plugin/hooks/classify-message.py` |
|
|
166
|
+
| Auto-execute skills | Set `{"classify_mode": "auto"}` in `vault/.codex-vault/config.json` |
|
|
166
167
|
| New agent | Add hooks and skills in `plugin/` ([guide](docs/adding-an-agent.md)) |
|
|
167
168
|
|
|
169
|
+
## CLI
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npx @suwujs/codex-vault init # Install vault + hooks into current project
|
|
173
|
+
npx @suwujs/codex-vault upgrade # Upgrade hooks and skills (preserves vault data)
|
|
174
|
+
npx @suwujs/codex-vault uninstall # Remove hooks and skills (preserves vault data)
|
|
175
|
+
```
|
|
176
|
+
|
|
168
177
|
## Requirements
|
|
169
178
|
|
|
170
179
|
- Git
|
|
171
180
|
- Python 3
|
|
181
|
+
- Node.js >= 18 (for CLI)
|
|
172
182
|
- One of: [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [Codex CLI](https://github.com/openai/codex)
|
|
173
183
|
- Optional: [Obsidian](https://obsidian.md) (for graph view, backlinks, visual browsing)
|
|
174
184
|
|
package/README.zh-CN.md
CHANGED
|
@@ -146,10 +146,25 @@ vault/
|
|
|
146
146
|
4. **图优先** — 目录按用途分组,`[[wikilinks]]` 按语义分组。链接是主要的组织工具。
|
|
147
147
|
5. **面向未来** — 即使模型有了内建记忆,vault 仍然有价值:可审计、可迁移、git 追踪的本地存储。
|
|
148
148
|
|
|
149
|
+
## CLI
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
npx @suwujs/codex-vault init # 安装 vault + hooks 到当前项目
|
|
153
|
+
npx @suwujs/codex-vault upgrade # 升级 hooks 和 skills(保留 vault 数据)
|
|
154
|
+
npx @suwujs/codex-vault uninstall # 移除 hooks 和 skills(保留 vault 数据)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## 配置
|
|
158
|
+
|
|
159
|
+
| 配置项 | 文件 | 说明 |
|
|
160
|
+
|--------|------|------|
|
|
161
|
+
| 自动执行 skills | `vault/.codex-vault/config.json` | `{"classify_mode": "auto"}` — 检测到意图后自动执行对应 skill,而非建议 |
|
|
162
|
+
|
|
149
163
|
## 依赖
|
|
150
164
|
|
|
151
165
|
- Git
|
|
152
166
|
- Python 3
|
|
167
|
+
- Node.js >= 18(CLI 安装用)
|
|
153
168
|
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 或 [Codex CLI](https://github.com/openai/codex)(二选一)
|
|
154
169
|
- 可选:[Obsidian](https://obsidian.md)(图谱视图、反向链接、可视化浏览)
|
|
155
170
|
|
package/package.json
CHANGED
package/plugin/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.4.0
|
|
@@ -20,6 +20,38 @@ if [ ! -f "Home.md" ] && [ ! -d "brain/" ]; then
|
|
|
20
20
|
fi
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
+
# --- Visible banner (stderr → user terminal) ---
|
|
24
|
+
{
|
|
25
|
+
echo ""
|
|
26
|
+
echo " ╭─────────────────────────────────────╮"
|
|
27
|
+
echo " │ 📚 Codex-Vault · Session Context │"
|
|
28
|
+
echo " ├─────────────────────────────────────┤"
|
|
29
|
+
|
|
30
|
+
# North Star preview — extract first non-empty bullet under "## Current Focus"
|
|
31
|
+
if [ -f "brain/North Star.md" ]; then
|
|
32
|
+
GOAL=$(sed -n '/^## Current Focus/,/^## /{/^- ./{s/^- //;p;q;};}' "brain/North Star.md" | cut -c1-40)
|
|
33
|
+
[ -n "$GOAL" ] && echo " │ 🎯 $GOAL" || echo " │ 🎯 (set goals in North Star.md)"
|
|
34
|
+
else
|
|
35
|
+
echo " │ 🎯 (create brain/North Star.md)"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Active work count
|
|
39
|
+
WORK_COUNT=$(find work/active -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
40
|
+
echo " │ 📋 $WORK_COUNT active project(s)"
|
|
41
|
+
|
|
42
|
+
# Uncommitted changes count
|
|
43
|
+
CHANGE_COUNT=$(git status --short -- . 2>/dev/null | wc -l | tr -d ' ')
|
|
44
|
+
if [ "$CHANGE_COUNT" -gt 0 ]; then
|
|
45
|
+
echo " │ ✏️ $CHANGE_COUNT uncommitted change(s)"
|
|
46
|
+
else
|
|
47
|
+
echo " │ ✅ working tree clean"
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
echo " ╰─────────────────────────────────────╯"
|
|
51
|
+
echo ""
|
|
52
|
+
} >&2
|
|
53
|
+
|
|
54
|
+
# --- Full context (stdout → agent) ---
|
|
23
55
|
echo "## Session Context"
|
|
24
56
|
echo ""
|
|
25
57
|
echo "### Date"
|
|
@@ -20,6 +20,38 @@ if [ ! -f "Home.md" ] && [ ! -d "brain/" ]; then
|
|
|
20
20
|
fi
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
+
# --- Visible banner (stderr → user terminal) ---
|
|
24
|
+
{
|
|
25
|
+
echo ""
|
|
26
|
+
echo " ╭─────────────────────────────────────╮"
|
|
27
|
+
echo " │ 📚 Codex-Vault · Session Context │"
|
|
28
|
+
echo " ├─────────────────────────────────────┤"
|
|
29
|
+
|
|
30
|
+
# North Star preview — extract first non-empty bullet under "## Current Focus"
|
|
31
|
+
if [ -f "brain/North Star.md" ]; then
|
|
32
|
+
GOAL=$(sed -n '/^## Current Focus/,/^## /{/^- ./{s/^- //;p;q;};}' "brain/North Star.md" | cut -c1-40)
|
|
33
|
+
[ -n "$GOAL" ] && echo " │ 🎯 $GOAL" || echo " │ 🎯 (set goals in North Star.md)"
|
|
34
|
+
else
|
|
35
|
+
echo " │ 🎯 (create brain/North Star.md)"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Active work count
|
|
39
|
+
WORK_COUNT=$(find work/active -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
40
|
+
echo " │ 📋 $WORK_COUNT active project(s)"
|
|
41
|
+
|
|
42
|
+
# Uncommitted changes count
|
|
43
|
+
CHANGE_COUNT=$(git status --short -- . 2>/dev/null | wc -l | tr -d ' ')
|
|
44
|
+
if [ "$CHANGE_COUNT" -gt 0 ]; then
|
|
45
|
+
echo " │ ✏️ $CHANGE_COUNT uncommitted change(s)"
|
|
46
|
+
else
|
|
47
|
+
echo " │ ✅ working tree clean"
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
echo " ╰─────────────────────────────────────╯"
|
|
51
|
+
echo ""
|
|
52
|
+
} >&2
|
|
53
|
+
|
|
54
|
+
# --- Full context (stdout → agent) ---
|
|
23
55
|
echo "## Session Context"
|
|
24
56
|
echo ""
|
|
25
57
|
echo "### Date"
|
|
@@ -40,12 +72,12 @@ echo "### Recent Changes"
|
|
|
40
72
|
COMMITS_48H=$(git log --oneline --since="48 hours ago" --no-merges 2>/dev/null | wc -l | tr -d ' ')
|
|
41
73
|
if [ "$COMMITS_48H" -gt 0 ]; then
|
|
42
74
|
echo "(last 48 hours)"
|
|
43
|
-
git log --oneline --since="48 hours ago" --no-merges 2>/dev/null | head -15
|
|
75
|
+
git log --oneline --since="48 hours ago" --no-merges 2>/dev/null | head -15 || true
|
|
44
76
|
else
|
|
45
77
|
COMMITS_7D=$(git log --oneline --since="7 days ago" --no-merges 2>/dev/null | wc -l | tr -d ' ')
|
|
46
78
|
if [ "$COMMITS_7D" -gt 0 ]; then
|
|
47
79
|
echo "(nothing in 48h — showing last 7 days)"
|
|
48
|
-
git log --oneline --since="7 days ago" --no-merges 2>/dev/null | head -15
|
|
80
|
+
git log --oneline --since="7 days ago" --no-merges 2>/dev/null | head -15 || true
|
|
49
81
|
else
|
|
50
82
|
echo "(nothing recent — showing last 5 commits)"
|
|
51
83
|
git log --oneline -5 --no-merges 2>/dev/null || echo "(no git history)"
|
|
@@ -84,7 +116,7 @@ echo ""
|
|
|
84
116
|
|
|
85
117
|
# Uncommitted changes — shows agent what's in-flight
|
|
86
118
|
echo "### Uncommitted Changes"
|
|
87
|
-
CHANGES=$(git status --short -- . 2>/dev/null | head -20)
|
|
119
|
+
CHANGES=$(git status --short -- . 2>/dev/null | head -20 || true)
|
|
88
120
|
if [ -n "$CHANGES" ]; then
|
|
89
121
|
echo "$CHANGES"
|
|
90
122
|
else
|