@suwujs/codex-vault 0.7.0 → 0.7.2

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
@@ -174,6 +174,14 @@ npx @suwujs/codex-vault upgrade # Upgrade hooks and skills (preserves vault
174
174
  npx @suwujs/codex-vault uninstall # Remove hooks and skills (preserves vault data)
175
175
  ```
176
176
 
177
+ ## Testing
178
+
179
+ ```bash
180
+ npm test # Full E2E test suite
181
+ npm run test:cli # CLI commands only (22 tests)
182
+ npm run test:hooks # Hook scripts only (33 tests)
183
+ ```
184
+
177
185
  ## Requirements
178
186
 
179
187
  - Git
package/README.zh-CN.md CHANGED
@@ -154,6 +154,14 @@ npx @suwujs/codex-vault upgrade # 升级 hooks 和 skills(保留 vault 数
154
154
  npx @suwujs/codex-vault uninstall # 移除 hooks 和 skills(保留 vault 数据)
155
155
  ```
156
156
 
157
+ ## 测试
158
+
159
+ ```bash
160
+ npm test # 完整 E2E 测试
161
+ npm run test:cli # CLI 命令测试(22 个)
162
+ npm run test:hooks # Hook 脚本测试(33 个)
163
+ ```
164
+
157
165
  ## 配置
158
166
 
159
167
  | 配置项 | 文件 | 说明 |
package/bin/cli.js CHANGED
@@ -7,7 +7,7 @@ const fs = require('fs');
7
7
 
8
8
  const PKG_ROOT = path.resolve(__dirname, '..');
9
9
  const INSTALL_SH = path.join(PKG_ROOT, 'plugin', 'install.sh');
10
- const VERSION = fs.readFileSync(path.join(PKG_ROOT, 'plugin', 'VERSION'), 'utf8').trim();
10
+ const VERSION = JSON.parse(fs.readFileSync(path.join(PKG_ROOT, 'package.json'), 'utf8')).version;
11
11
 
12
12
  const args = process.argv.slice(2);
13
13
  const cmd = args[0] || 'init';
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "@suwujs/codex-vault",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Persistent knowledge vault for LLM agents (Claude Code, Codex CLI)",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/sukbearai/codex-vault"
9
9
  },
10
+ "scripts": {
11
+ "test": "bash tests/test_e2e.sh",
12
+ "test:cli": "bash tests/test_cli.sh",
13
+ "test:hooks": "bash tests/test_hooks.sh"
14
+ },
10
15
  "bin": {
11
16
  "codex-vault": "bin/cli.js"
12
17
  },
File without changes
@@ -1,28 +0,0 @@
1
- #!/bin/bash
2
- # Codex-Vault wrapper — shows vault banner then launches Codex CLI
3
- # Usage: codex-vault-run [codex args...]
4
-
5
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
6
- PROJECT_DIR="$(pwd)"
7
-
8
- # Find session-start hook relative to project or plugin
9
- HOOK=""
10
- for candidate in \
11
- "$PROJECT_DIR/plugin/hooks/codex/session-start.py" \
12
- "$PROJECT_DIR/.codex-vault/hooks/codex/session-start.py" \
13
- "$SCRIPT_DIR/../plugin/hooks/codex/session-start.py"; do
14
- if [ -f "$candidate" ]; then
15
- HOOK="$candidate"
16
- break
17
- fi
18
- done
19
-
20
- if [ -n "$HOOK" ]; then
21
- SUMMARY=$(echo '{}' | python3 "$HOOK" 2>/dev/null \
22
- | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('systemMessage',''))" 2>/dev/null)
23
- if [ -n "$SUMMARY" ]; then
24
- echo " $SUMMARY"
25
- fi
26
- fi
27
-
28
- exec codex "$@"
package/plugin/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.6.0
@@ -1,39 +0,0 @@
1
- {
2
- "hooks": {
3
- "SessionStart": [
4
- {
5
- "matcher": "startup|resume|compact",
6
- "hooks": [
7
- {
8
- "type": "command",
9
- "command": "python3 .codex-vault/hooks/claude/session-start.py",
10
- "timeout": 30
11
- }
12
- ]
13
- }
14
- ],
15
- "UserPromptSubmit": [
16
- {
17
- "hooks": [
18
- {
19
- "type": "command",
20
- "command": "python3 .codex-vault/hooks/claude/classify-message.py",
21
- "timeout": 15
22
- }
23
- ]
24
- }
25
- ],
26
- "PostToolUse": [
27
- {
28
- "matcher": "Write|Edit",
29
- "hooks": [
30
- {
31
- "type": "command",
32
- "command": "python3 .codex-vault/hooks/claude/validate-write.py",
33
- "timeout": 15
34
- }
35
- ]
36
- }
37
- ]
38
- }
39
- }
@@ -1,29 +0,0 @@
1
- ---
2
- name: dump
3
- description: "Freeform capture — dump anything (notes, ideas, decisions, links) and it gets classified and routed to the right vault location. Triggers: 'dump this', 'capture', 'save this thought', 'note this down', 'remember this', 'jot down'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Process the following freeform dump. For each distinct piece of information:
12
-
13
- 1. **Classify** it: decision, project update, win/achievement, or general work note.
14
- 2. **Search first**: Check if a related note already exists. Prefer updating over creating.
15
- 3. **Create or update** the appropriate note:
16
- - Correct folder (work/active/, brain/, etc.)
17
- - Full YAML frontmatter (date, description, tags)
18
- - All relevant [[wikilinks]]
19
- 4. **Update indexes**: `work/Index.md`, `brain/` notes as needed.
20
- 5. **Cross-link**: Every new note links to at least one existing note.
21
-
22
- After processing, summarize:
23
- - What was captured and where
24
- - New notes created (with paths)
25
- - Existing notes updated
26
- - Anything unclear (ask the user)
27
-
28
- Content to process:
29
- $ARGUMENTS
@@ -1,63 +0,0 @@
1
- ---
2
- name: ingest
3
- description: "Import external content (URLs, files, text) into the vault as structured source notes. Triggers: 'ingest', 'import this', 'save this article', 'add source', 'read and save'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Ingest a source into the vault. Follow these steps:
12
-
13
- ### 1. Locate the Source
14
-
15
- The user provides either:
16
- - A filename in `sources/` (e.g., `sources/karpathy-llm-wiki.md`)
17
- - A URL to fetch (use `defuddle parse <url> --md` or `curl` to save to `sources/` first)
18
-
19
- If a URL, save the raw content to `sources/` before proceeding — sources are the immutable record.
20
-
21
- ### 2. Read the Source
22
-
23
- Read the full source document. Do not skim — ingestion depends on thorough reading.
24
-
25
- ### 3. Discuss Key Takeaways
26
-
27
- Present the top 3-5 takeaways to the user. Ask:
28
- - Which points are most relevant to current work?
29
- - Any connections to existing vault notes?
30
- - Anything to skip or emphasize?
31
-
32
- Wait for user input before proceeding.
33
-
34
- ### 4. Create a Source Summary
35
-
36
- Create a note in `work/active/` using the **Source Summary** template:
37
- - Fill in all YAML frontmatter (date, description, source, tags)
38
- - Write Key Takeaways, Summary, Connections (with [[wikilinks]]), Quotes/Data Points
39
- - The `source` field should reference the file in `sources/` or the original URL
40
-
41
- ### 5. Update Indexes
42
-
43
- - Add the summary to `work/Index.md` under a "Sources" section (create the section if it doesn't exist)
44
- - Update relevant `brain/` notes if the source contains decisions (`Key Decisions.md`), patterns (`Patterns.md`), or context worth remembering (`Memories.md`)
45
-
46
- ### 6. Cross-Link
47
-
48
- Check existing vault notes for connections:
49
- - Do any active projects relate to this source?
50
- - Does the source reinforce or challenge any existing decisions?
51
- - Add [[wikilinks]] in both directions where relevant
52
-
53
- ### 7. Report
54
-
55
- Summarize what was done:
56
- - Source file location
57
- - Summary note created (path)
58
- - Indexes updated
59
- - Cross-links added
60
- - Brain notes updated (if any)
61
-
62
- Source to process:
63
- $ARGUMENTS
@@ -1,54 +0,0 @@
1
- ---
2
- name: recall
3
- description: "Search vault memory for a topic — finds relevant notes across brain, work, reference, and sources. Triggers: 'recall', 'what do I know about', 'search memory', 'find notes about', 'look up'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Search the vault for information about the given topic.
12
-
13
- ### 1. Parse the Query
14
-
15
- Extract the key topic or question from the user's input.
16
-
17
- ### 2. Search the Vault
18
-
19
- Two-pass search — semantic first, keyword fallback:
20
-
21
- **Pass 1 — Frontmatter scan (semantic):**
22
- Read the first 5 lines (YAML frontmatter) of every `.md` file in the vault. Use the `description` and `tags` fields to judge relevance semantically — match by meaning, not just keywords. For example, a query about "caching" should match a note with description "Redis selection for session storage".
23
-
24
- Scan in priority order:
25
- 1. `brain/` — persistent memory
26
- 2. `work/active/` — current projects
27
- 3. `reference/` — saved analyses
28
- 4. `work/archive/` — completed work
29
- 5. `sources/` — raw source documents
30
-
31
- **Pass 2 — Keyword grep (fallback):**
32
- If Pass 1 finds fewer than 2 relevant files, supplement with a keyword grep across file contents.
33
-
34
- ### 3. Read Matches
35
-
36
- Read the top 3-5 relevant files in full. Prioritize files where the topic appears in:
37
- - The description or tags (strongest signal)
38
- - Headings
39
- - Multiple times in the body
40
-
41
- ### 4. Synthesize
42
-
43
- Present what the vault knows about this topic:
44
- - **Found in**: list the files (as [[wikilinks]])
45
- - **Summary**: synthesize the relevant information across all matches
46
- - **Connections**: note any links between the matched notes
47
- - **Gaps**: flag if the vault has limited or no information on this topic
48
-
49
- ### 5. Offer Writeback
50
-
51
- If the synthesis is substantial (combines 3+ sources), offer to save it as a reference note.
52
-
53
- Topic to recall:
54
- $ARGUMENTS
@@ -1,35 +0,0 @@
1
- ---
2
- name: wrap-up
3
- description: "End-of-session wrap-up — commits changes, updates indexes, captures decisions made. Triggers: 'wrap up', 'end session', 'save progress', 'commit and close', 'done for today'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Session wrap-up. Review what was done and leave the vault clean.
12
-
13
- ### 1. Review
14
- Scan the conversation for notes created or modified. List them all.
15
-
16
- ### 2. Verify Quality
17
- For each note: frontmatter complete? At least one [[wikilink]]? Correct folder?
18
-
19
- ### 3. Check Indexes
20
- - `work/Index.md` — new notes linked? Completed projects moved?
21
- - `brain/Memories.md` — Recent Context updated?
22
- - `brain/Key Decisions.md` — new decisions captured?
23
- - `brain/Patterns.md` — new patterns observed?
24
-
25
- ### 4. Check for Orphans
26
- Any new notes not linked from at least one other note?
27
-
28
- ### 5. Archive Check
29
- Notes in `work/active/` that should move to `work/archive/`?
30
-
31
- ### 6. Report
32
- - **Done**: what was captured
33
- - **Fixed**: issues resolved
34
- - **Flagged**: needs user input
35
- - **Suggested**: improvements for next time
@@ -1,2 +0,0 @@
1
- [features]
2
- codex_hooks = true
@@ -1,28 +0,0 @@
1
- {
2
- "hooks": {
3
- "SessionStart": [
4
- {
5
- "matcher": "startup|resume",
6
- "hooks": [
7
- {
8
- "type": "command",
9
- "command": "python3 .codex-vault/hooks/codex/session-start.py",
10
- "timeout": 30,
11
- "statusMessage": "\ud83d\udcda Codex-Vault loading..."
12
- }
13
- ]
14
- }
15
- ],
16
- "UserPromptSubmit": [
17
- {
18
- "hooks": [
19
- {
20
- "type": "command",
21
- "command": "python3 .codex-vault/hooks/codex/classify-message.py",
22
- "timeout": 15
23
- }
24
- ]
25
- }
26
- ]
27
- }
28
- }
@@ -1,29 +0,0 @@
1
- ---
2
- name: dump
3
- description: "Freeform capture — dump anything (notes, ideas, decisions, links) and it gets classified and routed to the right vault location. Triggers: 'dump this', 'capture', 'save this thought', 'note this down', 'remember this', 'jot down'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Process the following freeform dump. For each distinct piece of information:
12
-
13
- 1. **Classify** it: decision, project update, win/achievement, or general work note.
14
- 2. **Search first**: Check if a related note already exists. Prefer updating over creating.
15
- 3. **Create or update** the appropriate note:
16
- - Correct folder (work/active/, brain/, etc.)
17
- - Full YAML frontmatter (date, description, tags)
18
- - All relevant [[wikilinks]]
19
- 4. **Update indexes**: `work/Index.md`, `brain/` notes as needed.
20
- 5. **Cross-link**: Every new note links to at least one existing note.
21
-
22
- After processing, summarize:
23
- - What was captured and where
24
- - New notes created (with paths)
25
- - Existing notes updated
26
- - Anything unclear (ask the user)
27
-
28
- Content to process:
29
- $ARGUMENTS
@@ -1,63 +0,0 @@
1
- ---
2
- name: ingest
3
- description: "Import external content (URLs, files, text) into the vault as structured source notes. Triggers: 'ingest', 'import this', 'save this article', 'add source', 'read and save'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Ingest a source into the vault. Follow these steps:
12
-
13
- ### 1. Locate the Source
14
-
15
- The user provides either:
16
- - A filename in `sources/` (e.g., `sources/karpathy-llm-wiki.md`)
17
- - A URL to fetch (use `defuddle parse <url> --md` or `curl` to save to `sources/` first)
18
-
19
- If a URL, save the raw content to `sources/` before proceeding — sources are the immutable record.
20
-
21
- ### 2. Read the Source
22
-
23
- Read the full source document. Do not skim — ingestion depends on thorough reading.
24
-
25
- ### 3. Discuss Key Takeaways
26
-
27
- Present the top 3-5 takeaways to the user. Ask:
28
- - Which points are most relevant to current work?
29
- - Any connections to existing vault notes?
30
- - Anything to skip or emphasize?
31
-
32
- Wait for user input before proceeding.
33
-
34
- ### 4. Create a Source Summary
35
-
36
- Create a note in `work/active/` using the **Source Summary** template:
37
- - Fill in all YAML frontmatter (date, description, source, tags)
38
- - Write Key Takeaways, Summary, Connections (with [[wikilinks]]), Quotes/Data Points
39
- - The `source` field should reference the file in `sources/` or the original URL
40
-
41
- ### 5. Update Indexes
42
-
43
- - Add the summary to `work/Index.md` under a "Sources" section (create the section if it doesn't exist)
44
- - Update relevant `brain/` notes if the source contains decisions (`Key Decisions.md`), patterns (`Patterns.md`), or context worth remembering (`Memories.md`)
45
-
46
- ### 6. Cross-Link
47
-
48
- Check existing vault notes for connections:
49
- - Do any active projects relate to this source?
50
- - Does the source reinforce or challenge any existing decisions?
51
- - Add [[wikilinks]] in both directions where relevant
52
-
53
- ### 7. Report
54
-
55
- Summarize what was done:
56
- - Source file location
57
- - Summary note created (path)
58
- - Indexes updated
59
- - Cross-links added
60
- - Brain notes updated (if any)
61
-
62
- Source to process:
63
- $ARGUMENTS
@@ -1,54 +0,0 @@
1
- ---
2
- name: recall
3
- description: "Search vault memory for a topic — finds relevant notes across brain, work, reference, and sources. Triggers: 'recall', 'what do I know about', 'search memory', 'find notes about', 'look up'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Search the vault for information about the given topic.
12
-
13
- ### 1. Parse the Query
14
-
15
- Extract the key topic or question from the user's input.
16
-
17
- ### 2. Search the Vault
18
-
19
- Two-pass search — semantic first, keyword fallback:
20
-
21
- **Pass 1 — Frontmatter scan (semantic):**
22
- Read the first 5 lines (YAML frontmatter) of every `.md` file in the vault. Use the `description` and `tags` fields to judge relevance semantically — match by meaning, not just keywords. For example, a query about "caching" should match a note with description "Redis selection for session storage".
23
-
24
- Scan in priority order:
25
- 1. `brain/` — persistent memory
26
- 2. `work/active/` — current projects
27
- 3. `reference/` — saved analyses
28
- 4. `work/archive/` — completed work
29
- 5. `sources/` — raw source documents
30
-
31
- **Pass 2 — Keyword grep (fallback):**
32
- If Pass 1 finds fewer than 2 relevant files, supplement with a keyword grep across file contents.
33
-
34
- ### 3. Read Matches
35
-
36
- Read the top 3-5 relevant files in full. Prioritize files where the topic appears in:
37
- - The description or tags (strongest signal)
38
- - Headings
39
- - Multiple times in the body
40
-
41
- ### 4. Synthesize
42
-
43
- Present what the vault knows about this topic:
44
- - **Found in**: list the files (as [[wikilinks]])
45
- - **Summary**: synthesize the relevant information across all matches
46
- - **Connections**: note any links between the matched notes
47
- - **Gaps**: flag if the vault has limited or no information on this topic
48
-
49
- ### 5. Offer Writeback
50
-
51
- If the synthesis is substantial (combines 3+ sources), offer to save it as a reference note.
52
-
53
- Topic to recall:
54
- $ARGUMENTS
@@ -1,35 +0,0 @@
1
- ---
2
- name: wrap-up
3
- description: "End-of-session wrap-up — commits changes, updates indexes, captures decisions made. Triggers: 'wrap up', 'end session', 'save progress', 'commit and close', 'done for today'."
4
- license: MIT
5
- metadata:
6
- author: sukbearai
7
- version: "1.0.0"
8
- homepage: "https://github.com/sukbearai/codex-vault"
9
- ---
10
-
11
- Session wrap-up. Review what was done and leave the vault clean.
12
-
13
- ### 1. Review
14
- Scan the conversation for notes created or modified. List them all.
15
-
16
- ### 2. Verify Quality
17
- For each note: frontmatter complete? At least one [[wikilink]]? Correct folder?
18
-
19
- ### 3. Check Indexes
20
- - `work/Index.md` — new notes linked? Completed projects moved?
21
- - `brain/Memories.md` — Recent Context updated?
22
- - `brain/Key Decisions.md` — new decisions captured?
23
- - `brain/Patterns.md` — new patterns observed?
24
-
25
- ### 4. Check for Orphans
26
- Any new notes not linked from at least one other note?
27
-
28
- ### 5. Archive Check
29
- Notes in `work/active/` that should move to `work/archive/`?
30
-
31
- ### 6. Report
32
- - **Done**: what was captured
33
- - **Fixed**: issues resolved
34
- - **Flagged**: needs user input
35
- - **Suggested**: improvements for next time