context-vault 3.4.4 → 3.4.5
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/assets/agent-rules.md +50 -0
- package/assets/setup-prompt.md +58 -0
- package/assets/skills/vault-setup/skill.md +81 -0
- package/bin/cli.js +533 -11
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +23 -0
- package/dist/helpers.js.map +1 -1
- package/dist/server.js +24 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/context-status.js +29 -28
- package/dist/tools/context-status.js.map +1 -1
- package/dist/tools/get-context.d.ts.map +1 -1
- package/dist/tools/get-context.js +22 -18
- package/dist/tools/get-context.js.map +1 -1
- package/dist/tools/list-context.d.ts.map +1 -1
- package/dist/tools/list-context.js +8 -8
- package/dist/tools/list-context.js.map +1 -1
- package/dist/tools/save-context.d.ts.map +1 -1
- package/dist/tools/save-context.js +37 -22
- package/dist/tools/save-context.js.map +1 -1
- package/dist/tools/session-start.d.ts.map +1 -1
- package/dist/tools/session-start.js +39 -5
- package/dist/tools/session-start.js.map +1 -1
- package/node_modules/@context-vault/core/dist/capture.d.ts.map +1 -1
- package/node_modules/@context-vault/core/dist/capture.js +11 -0
- package/node_modules/@context-vault/core/dist/capture.js.map +1 -1
- package/node_modules/@context-vault/core/dist/config.d.ts +8 -0
- package/node_modules/@context-vault/core/dist/config.d.ts.map +1 -1
- package/node_modules/@context-vault/core/dist/config.js +20 -1
- package/node_modules/@context-vault/core/dist/config.js.map +1 -1
- package/node_modules/@context-vault/core/dist/frontmatter.d.ts.map +1 -1
- package/node_modules/@context-vault/core/dist/frontmatter.js +2 -0
- package/node_modules/@context-vault/core/dist/frontmatter.js.map +1 -1
- package/node_modules/@context-vault/core/package.json +1 -1
- package/node_modules/@context-vault/core/src/capture.ts +9 -0
- package/node_modules/@context-vault/core/src/config.ts +22 -1
- package/node_modules/@context-vault/core/src/frontmatter.ts +2 -0
- package/package.json +2 -2
- package/scripts/prepack.js +17 -0
- package/src/helpers.ts +25 -0
- package/src/server.ts +25 -2
- package/src/tools/context-status.ts +30 -30
- package/src/tools/get-context.ts +23 -24
- package/src/tools/list-context.ts +8 -11
- package/src/tools/save-context.ts +39 -25
- package/src/tools/session-start.ts +36 -5
|
@@ -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
|