context-vault 3.4.4 → 3.5.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 (86) hide show
  1. package/assets/agent-rules.md +50 -0
  2. package/assets/setup-prompt.md +58 -0
  3. package/assets/skills/vault-setup/skill.md +81 -0
  4. package/bin/cli.js +753 -126
  5. package/dist/helpers.d.ts +2 -0
  6. package/dist/helpers.d.ts.map +1 -1
  7. package/dist/helpers.js +23 -0
  8. package/dist/helpers.js.map +1 -1
  9. package/dist/server.js +26 -2
  10. package/dist/server.js.map +1 -1
  11. package/dist/status.d.ts.map +1 -1
  12. package/dist/status.js +29 -0
  13. package/dist/status.js.map +1 -1
  14. package/dist/tools/context-status.d.ts.map +1 -1
  15. package/dist/tools/context-status.js +64 -29
  16. package/dist/tools/context-status.js.map +1 -1
  17. package/dist/tools/get-context.js +23 -18
  18. package/dist/tools/get-context.js.map +1 -1
  19. package/dist/tools/list-context.d.ts +2 -1
  20. package/dist/tools/list-context.d.ts.map +1 -1
  21. package/dist/tools/list-context.js +27 -10
  22. package/dist/tools/list-context.js.map +1 -1
  23. package/dist/tools/save-context.d.ts +2 -1
  24. package/dist/tools/save-context.d.ts.map +1 -1
  25. package/dist/tools/save-context.js +95 -26
  26. package/dist/tools/save-context.js.map +1 -1
  27. package/dist/tools/session-start.d.ts.map +1 -1
  28. package/dist/tools/session-start.js +230 -11
  29. package/dist/tools/session-start.js.map +1 -1
  30. package/node_modules/@context-vault/core/dist/capture.d.ts.map +1 -1
  31. package/node_modules/@context-vault/core/dist/capture.js +13 -0
  32. package/node_modules/@context-vault/core/dist/capture.js.map +1 -1
  33. package/node_modules/@context-vault/core/dist/config.d.ts +8 -0
  34. package/node_modules/@context-vault/core/dist/config.d.ts.map +1 -1
  35. package/node_modules/@context-vault/core/dist/config.js +47 -2
  36. package/node_modules/@context-vault/core/dist/config.js.map +1 -1
  37. package/node_modules/@context-vault/core/dist/constants.d.ts +13 -0
  38. package/node_modules/@context-vault/core/dist/constants.d.ts.map +1 -1
  39. package/node_modules/@context-vault/core/dist/constants.js +13 -0
  40. package/node_modules/@context-vault/core/dist/constants.js.map +1 -1
  41. package/node_modules/@context-vault/core/dist/db.d.ts +1 -1
  42. package/node_modules/@context-vault/core/dist/db.d.ts.map +1 -1
  43. package/node_modules/@context-vault/core/dist/db.js +73 -9
  44. package/node_modules/@context-vault/core/dist/db.js.map +1 -1
  45. package/node_modules/@context-vault/core/dist/frontmatter.d.ts.map +1 -1
  46. package/node_modules/@context-vault/core/dist/frontmatter.js +2 -0
  47. package/node_modules/@context-vault/core/dist/frontmatter.js.map +1 -1
  48. package/node_modules/@context-vault/core/dist/index.d.ts +4 -1
  49. package/node_modules/@context-vault/core/dist/index.d.ts.map +1 -1
  50. package/node_modules/@context-vault/core/dist/index.js +58 -10
  51. package/node_modules/@context-vault/core/dist/index.js.map +1 -1
  52. package/node_modules/@context-vault/core/dist/indexing.d.ts +8 -0
  53. package/node_modules/@context-vault/core/dist/indexing.d.ts.map +1 -0
  54. package/node_modules/@context-vault/core/dist/indexing.js +22 -0
  55. package/node_modules/@context-vault/core/dist/indexing.js.map +1 -0
  56. package/node_modules/@context-vault/core/dist/main.d.ts +3 -2
  57. package/node_modules/@context-vault/core/dist/main.d.ts.map +1 -1
  58. package/node_modules/@context-vault/core/dist/main.js +3 -1
  59. package/node_modules/@context-vault/core/dist/main.js.map +1 -1
  60. package/node_modules/@context-vault/core/dist/search.d.ts +2 -0
  61. package/node_modules/@context-vault/core/dist/search.d.ts.map +1 -1
  62. package/node_modules/@context-vault/core/dist/search.js +82 -6
  63. package/node_modules/@context-vault/core/dist/search.js.map +1 -1
  64. package/node_modules/@context-vault/core/dist/types.d.ts +24 -0
  65. package/node_modules/@context-vault/core/dist/types.d.ts.map +1 -1
  66. package/node_modules/@context-vault/core/package.json +5 -1
  67. package/node_modules/@context-vault/core/src/capture.ts +11 -0
  68. package/node_modules/@context-vault/core/src/config.ts +40 -2
  69. package/node_modules/@context-vault/core/src/constants.ts +15 -0
  70. package/node_modules/@context-vault/core/src/db.ts +73 -9
  71. package/node_modules/@context-vault/core/src/frontmatter.ts +2 -0
  72. package/node_modules/@context-vault/core/src/index.ts +65 -11
  73. package/node_modules/@context-vault/core/src/indexing.ts +35 -0
  74. package/node_modules/@context-vault/core/src/main.ts +5 -0
  75. package/node_modules/@context-vault/core/src/search.ts +96 -6
  76. package/node_modules/@context-vault/core/src/types.ts +26 -0
  77. package/package.json +2 -2
  78. package/scripts/prepack.js +17 -0
  79. package/src/helpers.ts +25 -0
  80. package/src/server.ts +28 -2
  81. package/src/status.ts +35 -0
  82. package/src/tools/context-status.ts +65 -30
  83. package/src/tools/get-context.ts +24 -24
  84. package/src/tools/list-context.ts +25 -13
  85. package/src/tools/save-context.ts +106 -29
  86. package/src/tools/session-start.ts +257 -13
@@ -0,0 +1,50 @@
1
+ <!-- context-vault-rules v1.0 -->
2
+ # Context Vault — Agent Rules
3
+
4
+ You have access to a persistent knowledge vault via MCP tools (`get_context`, `save_context`, `list_context`, `delete_context`). Use it to build lasting memory across sessions.
5
+
6
+ ## When to Retrieve
7
+
8
+ Check the vault when you're about to invest effort that past knowledge could shortcut. Apply this test: "Might I or a previous session have encountered this before?" If yes, search first.
9
+
10
+ Retrieval triggers:
11
+ - **Starting a session**: call `session_start()` or `get_context(query: "<project or task context>")` to load relevant prior knowledge
12
+ - **Hitting an error**: search for the error message or root cause before debugging from scratch
13
+ - **Making a decision**: check if this architectural or design choice was already made and why
14
+ - **Integrating with an API, library, or service**: search for known quirks, gotchas, or working patterns
15
+ - **Entering an unfamiliar area of the codebase**: check for prior insights about that module or domain
16
+ - **Before saving**: search to avoid duplicates and to update existing entries instead
17
+
18
+ A vault search takes milliseconds. Debugging from scratch takes minutes. Always check first.
19
+
20
+ ## When to Save
21
+
22
+ Save when you encounter something a future session would benefit from knowing. Apply this test: "Would I tell a colleague about this to save them time?" If yes, save it.
23
+
24
+ Save triggers:
25
+ - Solved a non-obvious bug (root cause was not apparent from the error)
26
+ - Discovered undocumented API/library/tool behavior
27
+ - Found a working integration pattern requiring non-obvious configuration
28
+ - Hit a framework limitation and found a workaround
29
+ - Made an architectural decision with tradeoffs worth preserving
30
+
31
+ ## When NOT to Save
32
+
33
+ - Facts derivable from reading the current code or git history
34
+ - The fix itself (that belongs in the commit, not the vault)
35
+ - Generic programming knowledge you already know
36
+ - Session-specific state (files edited, commands run)
37
+
38
+ ## How to Save
39
+
40
+ Every entry must have:
41
+ - `title`: clear, specific (not "auth fix" but "Express 5 raw body parser breaks Stripe webhook verification")
42
+ - `tags`: at minimum a `bucket:<project>` tag for scoping
43
+ - `kind`: insight, pattern, reference, decision, or event
44
+ - `tier`: `working` for active context, `durable` for long-term reference
45
+
46
+ Capture what was learned (the insight), why it matters (what problem it prevents), and when it applies (what context makes it relevant).
47
+
48
+ ## Session Review
49
+
50
+ At the end of significant work sessions, review what you learned. If the session produced novel knowledge (not every session does), save 1-3 consolidated entries. Prefer one solid entry over multiple fragments.
@@ -0,0 +1,58 @@
1
+ # Context Vault: Agent-Assisted Setup Prompt
2
+
3
+ Paste the prompt below into your AI coding assistant (Claude Code, Cursor, Windsurf, etc.) after installing context-vault to customize your installation.
4
+
5
+ ---
6
+
7
+ ## Prompt
8
+
9
+ ```
10
+ I just installed context-vault as an MCP server. Help me set it up properly for my workflow. Do these steps in order, asking me before making any changes:
11
+
12
+ 1. Verify the vault MCP connection is working by calling context_status()
13
+
14
+ 2. Scan my existing rules and instructions:
15
+ - Read files in ~/.claude/rules/ (or equivalent for this client)
16
+ - Read any CLAUDE.md in my current project and home directory
17
+ - Read .cursorrules or .windsurfrules if they exist
18
+ - Tell me if you find any existing vault-related instructions
19
+
20
+ 3. Check if a context-vault rules file is already installed. If not, offer to install one. The rules file teaches you when and how to save knowledge to my vault automatically. Show me the exact content before writing anything.
21
+
22
+ 4. Check for conflicts between the vault rules and my existing instructions. Flag any contradictions or redundancies and ask me how to resolve them.
23
+
24
+ 5. Scan my current workspace for projects (look for package.json, .git, Cargo.toml, pyproject.toml, etc.). For each project, propose a vault bucket name and create it if I approve.
25
+
26
+ 6. Show me a summary of everything you configured.
27
+
28
+ Important:
29
+ - Never modify my existing rules files. Only create a new dedicated context-vault rules file or append with clear delimiter markers.
30
+ - Show me exact file paths and content before writing anything.
31
+ - If I decline any step, skip it.
32
+ ```
33
+
34
+ ---
35
+
36
+ ## What this does
37
+
38
+ After running this prompt, your AI agent will:
39
+
40
+ - **Verify** your vault connection is working
41
+ - **Detect** your existing rules and avoid conflicts
42
+ - **Install** a rules file that teaches the agent when to save knowledge automatically
43
+ - **Configure** project-specific vault buckets for organized storage
44
+
45
+ The rules file is a small (~50 lines) markdown file that guides your agent on:
46
+ - When to save (after solving non-obvious bugs, finding undocumented behavior, etc.)
47
+ - When NOT to save (generic knowledge, code-derivable facts)
48
+ - How to save (with proper titles, tags, and tiers)
49
+ - Session review (consolidating learnings at end of work sessions)
50
+
51
+ You can edit or delete the rules file at any time. It lives at:
52
+ - **Claude Code:** `~/.claude/rules/context-vault.md`
53
+ - **Cursor:** `~/.cursor/rules/context-vault.mdc` (global Cursor rules)
54
+ - **Windsurf:** `~/.windsurfrules` (appended with delimiter markers)
55
+
56
+ ## Manual installation
57
+
58
+ If you prefer not to use agent-assisted setup, you can copy the rules file content directly from the [Agent Rules Reference](/docs/agent-rules) page on our website.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: vault-setup
3
+ description: >
4
+ Agent-assisted context vault setup and customization. Verifies the MCP
5
+ connection, detects existing rules, scans projects for vault buckets, and
6
+ resolves conflicts with existing instructions — all with explicit user approval
7
+ before making any changes.
8
+ Triggers: "/vault setup", "set up my vault", "configure vault", "customize vault",
9
+ "vault setup", "personalize vault".
10
+ ---
11
+
12
+ # vault-setup skill
13
+
14
+ Agent-assisted setup that customizes the context-vault installation for the user's workflow. Always show what you plan to do before doing it. Never modify existing rules without permission.
15
+
16
+ ## Step 1 — Verify vault connection
17
+
18
+ Call `context_status()` (or `get_context(query: "test", limit: 1)` if context_status is unavailable). Report:
19
+ - Whether the MCP connection is working
20
+ - Vault location and entry count
21
+ - If it fails: print the exact error and stop — the MCP server needs to be running first
22
+
23
+ ## Step 2 — Scan existing rules
24
+
25
+ Read these locations silently (do not write anything yet):
26
+ - `~/.claude/rules/` — list all files
27
+ - `~/.claude/rules/context-vault.md` — the installed rules file (if present)
28
+ - `CLAUDE.md` in the current working directory (if it exists)
29
+ - `~/.claude/CLAUDE.md` (if it exists)
30
+ - `.cursorrules` in cwd (if it exists)
31
+ - `.windsurfrules` in cwd (if it exists)
32
+
33
+ Report what you found:
34
+ - Whether a context-vault rules file is already installed and its version
35
+ - Any existing vault-related instructions in other files (quote them)
36
+ - Any conflicts or redundancies
37
+
38
+ ## Step 3 — Check for conflicts
39
+
40
+ Compare the installed rules (if any) against the user's existing instructions. Flag:
41
+ - Contradictions (e.g., "always save everything" vs the vault's quality heuristic)
42
+ - Redundancies (e.g., the user already has identical instructions in CLAUDE.md)
43
+ - Missing rules (vault connection not verified, no bucket conventions set)
44
+
45
+ Ask the user how to resolve each conflict before proceeding.
46
+
47
+ ## Step 4 — Scan for projects
48
+
49
+ Look in the current working directory and one level up for project roots:
50
+ - Files: `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, `pom.xml`
51
+ - Directories: `.git`
52
+
53
+ For each project found, propose a vault bucket name (lowercase, hyphens, derived from the project name or directory). Example: `my-app` → `bucket:my-app`.
54
+
55
+ Ask: "I found these projects. Create vault buckets for them? I'll add bucket conventions to your rules."
56
+
57
+ Only proceed if the user approves.
58
+
59
+ ## Step 5 — Apply changes
60
+
61
+ For each approved change, show the exact content and path before writing. Changes may include:
62
+ - Creating or updating `~/.claude/rules/context-vault.md` with project-specific bucket conventions
63
+ - Appending project bucket notes to the rules file
64
+
65
+ Never modify the user's own rules files (CLAUDE.md, .cursorrules, etc.). Only write to the dedicated context-vault rules file.
66
+
67
+ ## Step 6 — Summary
68
+
69
+ Print a final summary:
70
+ - What was configured
71
+ - Where each file was written
72
+ - How to view the rules: `context-vault rules show`
73
+ - How to remove everything: `context-vault uninstall`
74
+
75
+ ## What NOT to do
76
+
77
+ - Do not save vault entries about the setup itself (the setup is not vault-worthy knowledge)
78
+ - Do not modify files without showing exact content first
79
+ - Do not delete or overwrite user-written rules
80
+ - Do not assume project structure — verify with file reads
81
+ - Do not proceed past a failed vault connection