claude-plugin-contextfs 0.2.15
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 +102 -0
- package/agents/memory-extractor.md +124 -0
- package/package.json +37 -0
- package/plugin.json +62 -0
- package/skills/recall.md +127 -0
- package/skills/remember.md +134 -0
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# ContextFS Plugin for Claude Code
|
|
2
|
+
|
|
3
|
+
Persistent memory management for Claude Code - save, search, and recall context across sessions.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Persistent Memory**: Save decisions, procedures, errors, and facts to long-term storage
|
|
8
|
+
- **Semantic Search**: Find relevant memories using hybrid keyword + semantic search
|
|
9
|
+
- **Session Management**: Automatically save and restore session context
|
|
10
|
+
- **Cross-Repo Support**: Share knowledge across multiple repositories
|
|
11
|
+
- **MCP Integration**: Full MCP server with 15+ tools
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Option 1: Install via Claude Plugin Registry
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
claude plugin add contextfs
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Option 2: Install via npm
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g claude-plugin-contextfs
|
|
25
|
+
claude plugin add claude-plugin-contextfs
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Option 3: Install via ContextFS CLI (Recommended)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Install ContextFS
|
|
32
|
+
pip install contextfs
|
|
33
|
+
|
|
34
|
+
# Install Claude Code integration
|
|
35
|
+
contextfs install claude
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Prerequisites
|
|
39
|
+
|
|
40
|
+
The plugin requires the ContextFS Python package to be installed:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install contextfs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Starting the MCP Server
|
|
49
|
+
|
|
50
|
+
Before using the plugin, start the MCP server:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
contextfs server
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Available Skills
|
|
57
|
+
|
|
58
|
+
- **/remember** - Extract and save important information from conversations
|
|
59
|
+
- **/recall** - Search memories for relevant context
|
|
60
|
+
|
|
61
|
+
### Available MCP Tools
|
|
62
|
+
|
|
63
|
+
| Tool | Description |
|
|
64
|
+
|------|-------------|
|
|
65
|
+
| `contextfs_save` | Save a new memory |
|
|
66
|
+
| `contextfs_search` | Search memories using hybrid search |
|
|
67
|
+
| `contextfs_recall` | Get a specific memory by ID |
|
|
68
|
+
| `contextfs_list` | List recent memories |
|
|
69
|
+
| `contextfs_evolve` | Update a memory with version history |
|
|
70
|
+
| `contextfs_link` | Create relationships between memories |
|
|
71
|
+
| `contextfs_delete` | Delete a memory |
|
|
72
|
+
| `contextfs_sessions` | List recent sessions |
|
|
73
|
+
| `contextfs_load_session` | Load a session's messages |
|
|
74
|
+
|
|
75
|
+
### Hooks
|
|
76
|
+
|
|
77
|
+
The plugin includes automatic hooks:
|
|
78
|
+
|
|
79
|
+
- **SessionStart**: Auto-recall relevant memories for current project
|
|
80
|
+
- **Stop**: Extract and save important information from the session
|
|
81
|
+
- **PreCompact**: Save session before context compaction
|
|
82
|
+
|
|
83
|
+
## Memory Types
|
|
84
|
+
|
|
85
|
+
| Type | Use Case |
|
|
86
|
+
|------|----------|
|
|
87
|
+
| `fact` | Learned information about codebase/user |
|
|
88
|
+
| `decision` | Architectural/design decisions with rationale |
|
|
89
|
+
| `procedural` | Step-by-step workflows and procedures |
|
|
90
|
+
| `error` | Errors encountered and their solutions |
|
|
91
|
+
| `code` | Code snippets and patterns |
|
|
92
|
+
| `episodic` | Session summaries |
|
|
93
|
+
|
|
94
|
+
## Links
|
|
95
|
+
|
|
96
|
+
- [ContextFS Documentation](https://github.com/magneticion/contextfs)
|
|
97
|
+
- [MCP Server Documentation](https://github.com/magneticion/contextfs#mcp-server)
|
|
98
|
+
- [Claude Code Plugins](https://claude-plugins.dev/)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Memory Extractor Agent
|
|
2
|
+
|
|
3
|
+
Automatically extract and save important information from conversations to ContextFS.
|
|
4
|
+
|
|
5
|
+
## Agent Configuration
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
name: memory-extractor
|
|
9
|
+
description: Extracts decisions, facts, errors, and procedures from conversations and saves to ContextFS
|
|
10
|
+
model: haiku # Fast model for extraction
|
|
11
|
+
tools:
|
|
12
|
+
- mcp__contextfs__contextfs_save
|
|
13
|
+
- mcp__contextfs__contextfs_search
|
|
14
|
+
- mcp__contextfs__contextfs_evolve
|
|
15
|
+
- mcp__contextfs__contextfs_link
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## System Prompt
|
|
19
|
+
|
|
20
|
+
You are a memory extraction specialist. Your job is to analyze conversations and extract valuable information for long-term storage in ContextFS.
|
|
21
|
+
|
|
22
|
+
### TYPE-SAFE Memory Operations
|
|
23
|
+
|
|
24
|
+
**CRITICAL: Some types REQUIRE structured_data with specific fields.**
|
|
25
|
+
|
|
26
|
+
| Type | Required Fields |
|
|
27
|
+
|------|-----------------|
|
|
28
|
+
| `decision` | `decision`, `rationale`, `alternatives[]` |
|
|
29
|
+
| `procedural` | `steps[]` |
|
|
30
|
+
| `error` | `error_type`, `message`, `resolution` |
|
|
31
|
+
|
|
32
|
+
| Type | No structured_data required |
|
|
33
|
+
|------|----------------------------|
|
|
34
|
+
| `fact` | Learned information |
|
|
35
|
+
| `code` | Code snippets |
|
|
36
|
+
| `episodic` | Session summaries |
|
|
37
|
+
|
|
38
|
+
### Extraction Examples
|
|
39
|
+
|
|
40
|
+
**1. Decision (REQUIRED structured_data)**
|
|
41
|
+
```python
|
|
42
|
+
contextfs_save(
|
|
43
|
+
type="decision",
|
|
44
|
+
summary="Redis chosen for session storage",
|
|
45
|
+
content="Session storage: Use Redis instead of PostgreSQL",
|
|
46
|
+
tags=["decision", "redis", "session", "architecture"],
|
|
47
|
+
structured_data={
|
|
48
|
+
"decision": "Use Redis for session storage", # REQUIRED
|
|
49
|
+
"rationale": "Sub-millisecond latency for auth", # REQUIRED
|
|
50
|
+
"alternatives": ["PostgreSQL", "Memcached"] # REQUIRED
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**2. Error (REQUIRED structured_data)**
|
|
56
|
+
```python
|
|
57
|
+
contextfs_save(
|
|
58
|
+
type="error",
|
|
59
|
+
summary="CORS policy blocked request",
|
|
60
|
+
content="Error: CORS policy blocked request from localhost:3000",
|
|
61
|
+
tags=["error", "cors", "frontend"],
|
|
62
|
+
structured_data={
|
|
63
|
+
"error_type": "CORSError", # REQUIRED
|
|
64
|
+
"message": "CORS policy blocked request", # REQUIRED
|
|
65
|
+
"resolution": "Add proxy config to package.json" # REQUIRED
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**3. Procedural (REQUIRED structured_data with steps[])**
|
|
71
|
+
```python
|
|
72
|
+
contextfs_save(
|
|
73
|
+
type="procedural",
|
|
74
|
+
summary="Deploy to production",
|
|
75
|
+
content="Production deployment procedure",
|
|
76
|
+
tags=["procedure", "deploy", "production"],
|
|
77
|
+
structured_data={
|
|
78
|
+
"title": "Production Deployment",
|
|
79
|
+
"steps": [ # REQUIRED
|
|
80
|
+
"Run tests locally",
|
|
81
|
+
"Build Docker image",
|
|
82
|
+
"Push to registry",
|
|
83
|
+
"Deploy via Railway"
|
|
84
|
+
],
|
|
85
|
+
"prerequisites": ["Docker", "Railway CLI"]
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**4. Fact (no structured_data required)**
|
|
91
|
+
```python
|
|
92
|
+
contextfs_save(
|
|
93
|
+
type="fact",
|
|
94
|
+
summary="API uses JWT with 1hr expiry",
|
|
95
|
+
content="The auth system uses JWT tokens with 1hr expiry, refresh tokens last 7 days",
|
|
96
|
+
tags=["fact", "auth", "jwt"]
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Extraction Rules
|
|
101
|
+
|
|
102
|
+
1. **Search before saving** - Always check if similar memory exists
|
|
103
|
+
2. **Evolve don't duplicate** - Use `contextfs_evolve` for updates
|
|
104
|
+
3. **Be concise** - Extract essence, not verbatim conversation
|
|
105
|
+
4. **Add context** - Include why information matters
|
|
106
|
+
5. **Tag appropriately** - Use consistent, searchable tags
|
|
107
|
+
6. **Link related** - Connect new memories to existing ones
|
|
108
|
+
7. **Use correct structured_data** - Decision/error/procedural REQUIRE it
|
|
109
|
+
|
|
110
|
+
### Output Format
|
|
111
|
+
|
|
112
|
+
For each extracted memory, report:
|
|
113
|
+
- Type and summary
|
|
114
|
+
- Tags applied
|
|
115
|
+
- Whether it's new or evolved from existing
|
|
116
|
+
- Memory ID for reference
|
|
117
|
+
|
|
118
|
+
## Invocation
|
|
119
|
+
|
|
120
|
+
This agent should be invoked:
|
|
121
|
+
1. At session end (via Stop hook)
|
|
122
|
+
2. Via `/remember` command
|
|
123
|
+
3. Periodically during long sessions
|
|
124
|
+
4. Before context compaction
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-plugin-contextfs",
|
|
3
|
+
"version": "0.2.15",
|
|
4
|
+
"description": "ContextFS memory management plugin for Claude Code - persistent memory across sessions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"plugin",
|
|
8
|
+
"contextfs",
|
|
9
|
+
"memory",
|
|
10
|
+
"mcp",
|
|
11
|
+
"ai",
|
|
12
|
+
"context",
|
|
13
|
+
"persistent-memory"
|
|
14
|
+
],
|
|
15
|
+
"author": "Matthew Long <matthew@yonedaai.com>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://github.com/magneticion/contextfs",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/magneticion/contextfs.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/magneticion/contextfs/issues"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"skills/**/*",
|
|
27
|
+
"agents/**/*",
|
|
28
|
+
"plugin.json",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "contextfs",
|
|
3
|
+
"version": "0.2.15",
|
|
4
|
+
"description": "Persistent memory management for Claude Code - save, search, and recall context across sessions",
|
|
5
|
+
"author": "Matthew Long",
|
|
6
|
+
"homepage": "https://github.com/magneticion/contextfs",
|
|
7
|
+
"skills": [
|
|
8
|
+
"skills/remember.md",
|
|
9
|
+
"skills/recall.md"
|
|
10
|
+
],
|
|
11
|
+
"agents": [
|
|
12
|
+
"agents/memory-extractor.md"
|
|
13
|
+
],
|
|
14
|
+
"mcpServers": {
|
|
15
|
+
"contextfs": {
|
|
16
|
+
"type": "sse",
|
|
17
|
+
"url": "http://127.0.0.1:3000/mcp/sse",
|
|
18
|
+
"description": "ContextFS MCP server - start with 'contextfs server'"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"hooks": {
|
|
22
|
+
"SessionStart": [
|
|
23
|
+
{
|
|
24
|
+
"matcher": "",
|
|
25
|
+
"hooks": [
|
|
26
|
+
{
|
|
27
|
+
"type": "command",
|
|
28
|
+
"command": "python -m contextfs.cli memory auto-recall --quiet"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"Stop": [
|
|
34
|
+
{
|
|
35
|
+
"matcher": "",
|
|
36
|
+
"hooks": [
|
|
37
|
+
{
|
|
38
|
+
"type": "command",
|
|
39
|
+
"command": "python -m contextfs.cli memory extract-transcript --save --quiet"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"PreCompact": [
|
|
45
|
+
{
|
|
46
|
+
"matcher": "",
|
|
47
|
+
"hooks": [
|
|
48
|
+
{
|
|
49
|
+
"type": "command",
|
|
50
|
+
"command": "python -m contextfs.cli memory save-session --label 'pre-compact' --quiet"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"requirements": {
|
|
57
|
+
"python": ">=3.10",
|
|
58
|
+
"packages": [
|
|
59
|
+
"contextfs"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
package/skills/recall.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Recall - Search and Load Relevant Context
|
|
2
|
+
|
|
3
|
+
Search ContextFS memory for relevant context based on the current task or query.
|
|
4
|
+
|
|
5
|
+
## Available Tools
|
|
6
|
+
|
|
7
|
+
| Tool | Purpose |
|
|
8
|
+
|------|---------|
|
|
9
|
+
| `contextfs_search` | Hybrid semantic + keyword search |
|
|
10
|
+
| `contextfs_sessions` | List recent sessions |
|
|
11
|
+
| `contextfs_load_session` | Load session messages |
|
|
12
|
+
| `contextfs_recall` | Get specific memory by ID |
|
|
13
|
+
| `contextfs_list` | List recent memories |
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Search Strategy
|
|
18
|
+
|
|
19
|
+
### If Starting a New Task
|
|
20
|
+
- Search for prior work on the same topic
|
|
21
|
+
- Search for relevant decisions and procedures
|
|
22
|
+
- Search for known errors and solutions
|
|
23
|
+
|
|
24
|
+
### If Debugging
|
|
25
|
+
- Search for similar errors (type="error")
|
|
26
|
+
- Search for related code patterns
|
|
27
|
+
- Search for prior debugging sessions
|
|
28
|
+
|
|
29
|
+
### If Exploring Code
|
|
30
|
+
- Search for architectural decisions (type="decision")
|
|
31
|
+
- Search for code patterns (type="code")
|
|
32
|
+
- Search for API documentation (type="api")
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Search Patterns
|
|
37
|
+
|
|
38
|
+
### General Search
|
|
39
|
+
```python
|
|
40
|
+
contextfs_search(
|
|
41
|
+
query="<topic or task>",
|
|
42
|
+
limit=5,
|
|
43
|
+
cross_repo=True # Search across all repositories
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Type-Filtered Search
|
|
48
|
+
```python
|
|
49
|
+
# Find decisions
|
|
50
|
+
contextfs_search(query="<topic>", type="decision", limit=3)
|
|
51
|
+
|
|
52
|
+
# Find errors and solutions
|
|
53
|
+
contextfs_search(query="<error or symptom>", type="error", limit=5)
|
|
54
|
+
|
|
55
|
+
# Find procedures
|
|
56
|
+
contextfs_search(query="<workflow>", type="procedural", limit=3)
|
|
57
|
+
|
|
58
|
+
# Find code patterns
|
|
59
|
+
contextfs_search(query="<pattern>", type="code", limit=5)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Project-Scoped Search
|
|
63
|
+
```python
|
|
64
|
+
contextfs_search(
|
|
65
|
+
query="<topic>",
|
|
66
|
+
project="my-project", # Filter by project
|
|
67
|
+
limit=5
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Session Management
|
|
74
|
+
|
|
75
|
+
### List Recent Sessions
|
|
76
|
+
```python
|
|
77
|
+
contextfs_sessions(limit=5, label="<optional filter>")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Load Specific Session
|
|
81
|
+
```python
|
|
82
|
+
contextfs_load_session(session_id="<id>", max_messages=20)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Get Specific Memory
|
|
88
|
+
```python
|
|
89
|
+
# Recall by ID (can use partial ID, min 8 chars)
|
|
90
|
+
contextfs_recall(id="abc12345")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Output
|
|
96
|
+
|
|
97
|
+
Present findings organized by relevance:
|
|
98
|
+
|
|
99
|
+
1. **Most Relevant Memories** - Direct matches to the query
|
|
100
|
+
2. **Related Decisions** - Prior decisions that may affect current work
|
|
101
|
+
3. **Known Issues** - Errors and solutions that may be relevant
|
|
102
|
+
4. **Procedures to Follow** - Established workflows for similar tasks
|
|
103
|
+
|
|
104
|
+
Include memory IDs for reference so user can request more details.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Example Usage
|
|
109
|
+
|
|
110
|
+
User: "I need to work on the authentication system"
|
|
111
|
+
|
|
112
|
+
Searches to run:
|
|
113
|
+
```python
|
|
114
|
+
# General search
|
|
115
|
+
contextfs_search(query="authentication system", limit=5, cross_repo=True)
|
|
116
|
+
|
|
117
|
+
# Decisions about auth
|
|
118
|
+
contextfs_search(query="auth", type="decision", limit=3)
|
|
119
|
+
|
|
120
|
+
# Known auth errors
|
|
121
|
+
contextfs_search(query="auth login", type="error", limit=3)
|
|
122
|
+
|
|
123
|
+
# Auth procedures
|
|
124
|
+
contextfs_search(query="authentication", type="procedural", limit=2)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Then synthesize findings into actionable context.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Remember - Save Conversation Insights to Memory
|
|
2
|
+
|
|
3
|
+
Extract and save important information from this conversation to ContextFS long-term memory.
|
|
4
|
+
|
|
5
|
+
## TYPE-SAFE Memory Operations
|
|
6
|
+
|
|
7
|
+
**CRITICAL: Some types REQUIRE structured_data with specific fields.**
|
|
8
|
+
|
|
9
|
+
### Types WITH Required structured_data
|
|
10
|
+
|
|
11
|
+
| Type | Required Fields |
|
|
12
|
+
|------|-----------------|
|
|
13
|
+
| `decision` | `decision`, `rationale`, `alternatives[]` |
|
|
14
|
+
| `procedural` | `steps[]` (title, prerequisites optional) |
|
|
15
|
+
| `error` | `error_type`, `message`, `resolution` |
|
|
16
|
+
| `api` | `endpoint`, `method` |
|
|
17
|
+
| `config` | `name`, `settings{}` |
|
|
18
|
+
|
|
19
|
+
### Types WITHOUT Required structured_data
|
|
20
|
+
|
|
21
|
+
| Type | Use Case |
|
|
22
|
+
|------|----------|
|
|
23
|
+
| `fact` | Learned information about codebase/user |
|
|
24
|
+
| `episodic` | Session summaries, conversations |
|
|
25
|
+
| `code` | Code snippets, patterns |
|
|
26
|
+
| `user` | User preferences |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Extraction Categories
|
|
31
|
+
|
|
32
|
+
### 1. Decisions Made (REQUIRED: structured_data)
|
|
33
|
+
```python
|
|
34
|
+
contextfs_save(
|
|
35
|
+
type="decision",
|
|
36
|
+
summary="Chose PostgreSQL over MongoDB",
|
|
37
|
+
content="Full rationale and context...",
|
|
38
|
+
tags=["decision", "<topic>"],
|
|
39
|
+
structured_data={
|
|
40
|
+
"decision": "Use PostgreSQL for user data", # REQUIRED
|
|
41
|
+
"rationale": "Team expertise, ACID compliance", # REQUIRED
|
|
42
|
+
"alternatives": ["MongoDB", "DynamoDB"] # REQUIRED
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Errors and Solutions (REQUIRED: structured_data)
|
|
48
|
+
```python
|
|
49
|
+
contextfs_save(
|
|
50
|
+
type="error",
|
|
51
|
+
summary="ChromaDB collection not found",
|
|
52
|
+
content="Full error context and stack trace...",
|
|
53
|
+
tags=["error", "<technology>"],
|
|
54
|
+
structured_data={
|
|
55
|
+
"error_type": "CollectionNotFoundError", # REQUIRED
|
|
56
|
+
"message": "Collection does not exist", # REQUIRED
|
|
57
|
+
"resolution": "Reconnect MCP server" # REQUIRED
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Procedures (REQUIRED: structured_data with steps[])
|
|
63
|
+
```python
|
|
64
|
+
contextfs_save(
|
|
65
|
+
type="procedural",
|
|
66
|
+
summary="Deploy to Railway",
|
|
67
|
+
content="Detailed deployment procedure...",
|
|
68
|
+
tags=["procedure", "<topic>"],
|
|
69
|
+
structured_data={
|
|
70
|
+
"title": "Railway Deployment", # optional
|
|
71
|
+
"steps": ["Build Docker", "Push to registry", "Redeploy"], # REQUIRED
|
|
72
|
+
"prerequisites": ["Docker installed", "Railway CLI configured"] # optional
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 4. Facts Learned (no structured_data required)
|
|
78
|
+
```python
|
|
79
|
+
contextfs_save(
|
|
80
|
+
type="fact",
|
|
81
|
+
summary="API uses JWT auth with 1hr expiry",
|
|
82
|
+
content="The auth system uses JWT tokens...",
|
|
83
|
+
tags=["fact", "<topic>"]
|
|
84
|
+
)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 5. Code Patterns (no structured_data required)
|
|
88
|
+
```python
|
|
89
|
+
contextfs_save(
|
|
90
|
+
type="code",
|
|
91
|
+
summary="Auth middleware pattern",
|
|
92
|
+
content="```python\ndef auth_middleware():\n ...\n```",
|
|
93
|
+
tags=["code", "<language>", "<pattern>"]
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Execution Steps
|
|
100
|
+
|
|
101
|
+
1. **Review the conversation** - Identify all memorable content
|
|
102
|
+
|
|
103
|
+
2. **Search before saving** - Check for duplicates:
|
|
104
|
+
```python
|
|
105
|
+
contextfs_search(query="<topic>", limit=3)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
3. **Evolve don't duplicate** - If similar memory exists, update it:
|
|
109
|
+
```python
|
|
110
|
+
contextfs_evolve(memory_id="<existing_id>", new_content="Updated info...")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
4. **Save new memories** - Use appropriate type WITH required structured_data
|
|
114
|
+
|
|
115
|
+
5. **Link related memories** - Connect to existing context:
|
|
116
|
+
```python
|
|
117
|
+
contextfs_link(from_id="<new_id>", to_id="<existing_id>", relation="related_to")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
6. **Save session** - Finally, save the session summary:
|
|
121
|
+
```python
|
|
122
|
+
contextfs_save(save_session="current", label="<descriptive-label>")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Output
|
|
128
|
+
|
|
129
|
+
After extraction, report:
|
|
130
|
+
- Number of memories saved by type
|
|
131
|
+
- Any memories that were evolved (updated) instead of created new
|
|
132
|
+
- Session label used
|
|
133
|
+
|
|
134
|
+
**Important**: Be thorough but avoid duplicating. Always search first, evolve if exists.
|