Skip to content

Commit 70f24ce

Browse files
committed
Add memtext skill and exclude .context from git
1 parent 65725e0 commit 70f24ce

15 files changed

Lines changed: 1033 additions & 48 deletions

File tree

.coverage

52 KB
Binary file not shown.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ data/aether/signature_index.ipc
5252
# --- Agent & RL4 Tools ---
5353
.agent/
5454
.rl4/
55+
56+
# --- Memtext Context ---
57+
.context/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description: Start SME native stack (operator + frontend, no sidecar)
3+
agent: code
4+
subtask: true
5+
---
6+
Start the SME v3.0.1 native stack without Docker:
7+
- SME Operator on port 8000 (includes AI provider)
8+
- Frontend on port 5173
9+
10+
Use PowerShell to start both services:
11+
12+
```powershell
13+
# Terminal 1 - Operator (includes AI provider)
14+
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd D:\SME; python -m src.api.main" -WindowStyle Normal
15+
16+
# Terminal 2 - Frontend
17+
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd D:\SME\frontend; npm run dev" -WindowStyle Normal
18+
```
19+
20+
Or use the script:
21+
```powershell
22+
.\start_native.ps1
23+
```
24+
25+
After starting, verify services:
26+
- Operator: http://localhost:8000/api/docs
27+
- Frontend: http://localhost:5173
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
name: context-offloading
3+
description: "Use when: saving agent context for future sessions, retrieving historical context, tracking decisions across sessions, enabling cross-session memory for agents, or maintaining project memory. Triggers: 'save context', 'remember', 'memory', 'prior context', 'load history', 'session memory', 'project memory'. NOT for: ephemeral context only, single-session tasks, or when context should not persist."
4+
---
5+
6+
# Context Offloading
7+
8+
Enable agents to save and retrieve context across sessions, creating persistent memory for coding agents. This skill stores decisions, session logs, and project identity in human-readable markdown files.
9+
10+
## When to Use This Skill
11+
12+
Use this skill when:
13+
- Saving important decisions and context for future sessions
14+
- Retrieving historical context before answering questions
15+
- Tracking architecture decisions across sessions
16+
- Enabling cross-session memory for agents
17+
- Onboarding new agents with project context
18+
19+
Do NOT use this skill when:
20+
- Ephemeral context only
21+
- Single-session tasks
22+
- Context should not persist
23+
- Project already has memory system
24+
25+
## Input Format
26+
27+
```yaml
28+
context_request:
29+
action: string # "init", "write", "query", "manage"
30+
content: string # Context to save (for write)
31+
tags: array # Optional: ["decision", "architecture", "setup"]
32+
query: string # Search query (for query)
33+
context_path: string # Custom path (optional, default: .context/)
34+
session_name: string # Session identifier (optional)
35+
```
36+
37+
## Output Format
38+
39+
```yaml
40+
context_result:
41+
status: "success" | "error"
42+
message: string
43+
written_to: string # File path if written
44+
results: array # Query results
45+
context_path: string # Where context is stored
46+
files_created: array # Files created during init
47+
```
48+
49+
## Capabilities
50+
51+
### 1. Initialize Context Storage (5 min)
52+
53+
- Create `.context/` directory structure
54+
- Create `identity.md` for project purpose, stack, conventions
55+
- Create `decisions.md` for architecture decisions
56+
- Create `session-logs/` for episodic notes
57+
- Create `.gitignore` to exclude from version control
58+
59+
### 2. Write Memory Note (5 min)
60+
61+
- Accept context content with optional tags
62+
- Route to appropriate file (identity, decisions, session-logs)
63+
- Append with timestamp and session identifier
64+
- Handle markdown formatting
65+
66+
### 3. Query Context (10 min)
67+
68+
- Accept search query string
69+
- Search all context files using grep
70+
- Rank results by relevance
71+
- Return results with source file and timestamp
72+
- Highlight matching content
73+
74+
### 4. Manage Session Logs (5 min)
75+
76+
- Create daily session files (YYYY-MM-DD.md)
77+
- Archive old sessions
78+
- List recent sessions
79+
- Clean up based on retention policy
80+
81+
## File Structure
82+
83+
```
84+
.context/
85+
├── .gitignore # Exclude from Git
86+
├── identity.md # Project purpose, stack, conventions
87+
├── decisions.md # Architecture decisions, policies
88+
├── session-logs/ # Episodic notes
89+
│ ├── 2026-04-07.md
90+
│ └── 2026-04-08.md
91+
└── index.md # Optional: quick reference index
92+
```
93+
94+
## Usage Examples
95+
96+
### Initialize Context Storage
97+
"Set up context storage in my project for persistent memory."
98+
99+
### Write a Decision
100+
"Save this decision: We chose PostgreSQL over MongoDB because of ACID compliance needs for financial data."
101+
102+
### Query Prior Context
103+
"What decisions were made about the database architecture?"
104+
"Find prior context about authentication implementation."
105+
106+
### Session Memory
107+
"Remember that we hit a bug with the payment API - the workaround was to retry with exponential backoff."
108+
109+
## Configuration Options
110+
111+
- `context_path`: Where to store context (default: `.context/`)
112+
- `retention_days`: Days to keep session logs (default: 90)
113+
- `include_gitignore`: Create .gitignore (default: true)
114+
- `auto_init`: Auto-create context on first write if missing
115+
116+
## Constraints
117+
118+
- MUST create human-readable markdown files
119+
- MUST maintain context across sessions
120+
- SHOULD support search functionality
121+
- MUST include timestamps on entries
122+
- SHOULD exclude from version control by default
123+
124+
## Integration Examples
125+
126+
- **Before answering**: Query context for relevant prior decisions
127+
- **After making decision**: Write decision to context
128+
- **On session start**: Load recent session logs for continuity
129+
- **Project onboarding**: Read identity.md for project context
130+
131+
## Dependencies
132+
133+
- Python 3.10+
134+
- Standard library: pathlib, subprocess (grep), datetime, re
135+
- Optional: SQLite (for future FTS5 search enhancement)

.kilo/skills/memtext/SKILL.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
name: memtext
3+
description: "Use when: context offloading, persistent memory across sessions, storing decisions, querying history, project memory management. Triggers: 'memtext', 'context storage', 'save context', 'remember', 'memory', 'persistent context'. NOT for: single-session tasks, when no persistence needed."
4+
---
5+
6+
# Memtext
7+
8+
Context offloading for AI agents - persistent memory across sessions. This skill provides both filesystem-based context storage and SQLite-backed memory with full-text search.
9+
10+
## When to Use This Skill
11+
12+
Use this skill when:
13+
- Saving agent context for future sessions
14+
- Storing decisions and architecture choices
15+
- Querying historical context
16+
- Managing project memory across sessions
17+
- Onboarding new agents with project context
18+
19+
Do NOT use this skill when:
20+
- Single-session tasks only
21+
- No persistence needed
22+
- Project already has memory system
23+
24+
## Input Format
25+
26+
```yaml
27+
context_request:
28+
action: string # "init", "save", "query", "log", "add", "list", "migrate", "synthesize"
29+
text: string # Context text to save/query
30+
tags: array # Optional tags for organization
31+
type: string # Entry type: decision, pattern, note, error, convention, memory
32+
importance: int # 1-5 importance level
33+
limit: int # Max results for queries
34+
session: string # Session identifier for logs
35+
scan: bool # Scan for projects
36+
all: bool # Process all logs (not just recent)
37+
```
38+
39+
## Output Format
40+
41+
```yaml
42+
context_result:
43+
status: "success" | "error" | "not_found"
44+
message: string
45+
entry_id: int # For add operations
46+
results: array # For query operations
47+
new_memories: int # For synthesize operations
48+
```
49+
50+
## Capabilities
51+
52+
### 1. Initialize Context Storage
53+
54+
```bash
55+
memtext init
56+
```
57+
58+
Creates:
59+
- `.context/` directory
60+
- `identity.md` - Project purpose, stack, conventions
61+
- `decisions.md` - Architecture decisions
62+
- `session-logs/` - Daily session notes
63+
- `memtext.db` - SQLite with FTS5 for full-text search
64+
- Auto-updates `.gitignore`
65+
66+
### 2. Save Context
67+
68+
```bash
69+
memtext save "We chose PostgreSQL for ACID compliance" --tags database architecture
70+
```
71+
72+
Saves to `decisions.md` with timestamp and tags.
73+
74+
### 3. Query Context
75+
76+
```bash
77+
memtext query database --limit 10
78+
```
79+
80+
Searches all markdown files using regex. Returns matching lines with file source.
81+
82+
### 4. Session Logging
83+
84+
```bash
85+
memtext log "Fixed auth bug with JWT refresh" --session bugfix
86+
```
87+
88+
Creates daily session logs in `.context/session-logs/YYYY-MM-DD.md`.
89+
90+
### 5. SQLite Storage
91+
92+
```bash
93+
# Add structured entry
94+
memtext add "API Decision" --content "Use REST not GraphQL for now" --type decision --tags api,rest --importance 3
95+
96+
# List entries
97+
memtext list --type decision --limit 20
98+
```
99+
100+
Uses SQLite with full-text search (FTS5) for fast retrieval.
101+
102+
### 6. Memory Synthesis
103+
104+
```bash
105+
# Scan logs for @memory markers
106+
memtext synthesize
107+
108+
# Process all logs
109+
memtext synthesize --all
110+
111+
# Manual synthesis
112+
memtext synthesize --text "Title: Content (@tags: t1, t2)"
113+
```
114+
115+
Extracts `@memory` markers from logs into structured memories.
116+
117+
### 7. Project Registry
118+
119+
```bash
120+
# List registered projects
121+
memtext projects
122+
123+
# Scan for projects with .context
124+
memtext projects --scan
125+
```
126+
127+
Cross-project tracking at `~/.config/memtext/projects.db`.
128+
129+
### 8. Migration
130+
131+
```bash
132+
memtext migrate
133+
```
134+
135+
Migrates v0.1.x filesystem context to SQLite database.
136+
137+
## Entry Types
138+
139+
| Type | Description |
140+
|------|-------------|
141+
| decision | Architecture decisions |
142+
| pattern | Reusable patterns discovered |
143+
| note | General notes |
144+
| error | Errors and workarounds |
145+
| convention | Project conventions |
146+
| memory | Synthesized high-value memories |
147+
148+
## Configuration
149+
150+
- `.context/` - Context storage directory (customizable)
151+
- `.context/memtext.db` - SQLite database
152+
- `~/.config/memtext/projects.db` - Global project registry
153+
154+
## Integration
155+
156+
- **Before answering**: Query context for relevant prior decisions
157+
- **After making decision**: `memtext save` to record
158+
- **Session end**: `memtext log` to summarize
159+
- **Periodic**: `memtext synthesize` to extract memories
160+
161+
## Dependencies
162+
163+
- Python 3.10+
164+
- Standard library: pathlib, re, datetime
165+
- SQLite (built-in)
166+
- Optional: ruff (linting)

0 commit comments

Comments
 (0)