Skip to content

Commit 2ba5c25

Browse files
committed
Improve memory skill workflow
1 parent aa69abd commit 2ba5c25

2 files changed

Lines changed: 82 additions & 161 deletions

File tree

skills/memory/SKILL.md

Lines changed: 80 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,200 +1,121 @@
11
---
22
name: memory
3-
description: Use AI DevKit's memory service to store and retrieve knowledge via CLI commands instead of MCP.
3+
description: Use AI DevKit memory via CLI commands. Search before non-trivial work, store verified reusable knowledge, update stale entries, and avoid saving transcripts, secrets, or one-off task progress.
44
---
55

6-
# AI DevKit Memory Skill
6+
# AI DevKit Memory CLI
77

8-
This skill teaches you how to use AI DevKit's **Memory** service through CLI commands. Memory allows you to store actionable insights, coding patterns, and project guidelines that persist across sessions.
8+
Use `npx ai-devkit@latest memory ...` as the durable knowledge layer.
99

10-
## When to Use This Skill
10+
## Workflow
1111

12-
Use the memory CLI commands when:
13-
- MCP (Model Context Protocol) is not available or not configured
14-
- You need to store knowledge directly from the terminal
15-
- You want to search for previously stored patterns or guidelines
16-
- You're scripting memory operations
12+
1. For implementation, debugging, review, planning, or documentation tasks, search before deep work unless the task is trivial:
13+
```bash
14+
npx ai-devkit@latest memory search --query "<task, subsystem, error, or convention>" --limit 5
15+
```
16+
For broad or risky tasks, search multiple angles: subsystem, error text, framework, command, and task intent.
1717

18-
## Prerequisites
18+
2. Use results as context:
19+
- Trust repo files, tests, fresh command output, and explicit user instructions over memory.
20+
- If memory conflicts with verified evidence, use the evidence and update the stale memory.
21+
- Mention memory only when it changes the plan or avoids asking the user again.
1922

20-
Ensure AI DevKit CLI is available:
21-
```bash
22-
npx ai-devkit@latest --version
23-
```
23+
3. Search before storing:
24+
```bash
25+
npx ai-devkit@latest memory search --query "<knowledge to store>" --table
26+
```
2427

25-
## Commands Reference
28+
4. Store or update only after the quality gate passes.
2629

27-
### Storing Knowledge
30+
## Quality Gate
2831

29-
Store new knowledge items using the `memory store` command:
32+
Before storing, all must be true:
3033

31-
```bash
32-
npx ai-devkit@latest memory store \
33-
--title "<short descriptive title>" \
34-
--content "<detailed knowledge content>" \
35-
--tags "<comma-separated tags>" \
36-
--scope "<scope>"
37-
```
34+
- Future sessions are likely to reuse it.
35+
- It is verified by code, docs, tests, command output, or explicit user instruction.
36+
- It is not merely a restatement of obvious nearby files unless it prevents repeated agent mistakes.
37+
- It is scoped narrowly enough.
38+
- Existing memory does not already cover it.
39+
- It contains no secrets, credentials, private customer data, personal data, raw logs, or temporary paths.
3840

39-
**Parameters:**
41+
Store:
42+
- Project conventions, user preferences, durable decisions.
43+
- Reusable fixes, testing patterns, commands, setup gotchas.
44+
- Non-obvious constraints, architecture rules, failure patterns.
4045

41-
| Parameter | Required | Description |
42-
|-------------|----------|-------------|
43-
| `--title` | Yes | Short, descriptive title (5-12 words, 10-100 chars) |
44-
| `--content` | Yes | Detailed explanation in markdown format (50-5000 chars) |
45-
| `--tags` | No | Comma-separated domain keywords (e.g., `typescript,react`) |
46-
| `--scope` | No | `global` (default), `project:<name>`, or `repo:<org/repo>` |
46+
Do not store:
47+
- Task progress, transcripts, speculation, generic programming facts.
48+
- Raw errors without diagnosis.
49+
- Anything the user did not intend to persist.
4750

48-
**Examples:**
51+
## Commands
4952

50-
```bash
51-
# Store a global coding pattern
52-
npx ai-devkit@latest memory store \
53-
--title "Always handle BigInt serialization in API responses" \
54-
--content "When returning BigInt values from API endpoints, convert them to strings using \`BigInt.toString()\` before serialization. JSON.stringify() cannot serialize BigInt natively." \
55-
--tags "api,backend,serialization" \
56-
--scope "global"
53+
### Search
5754

58-
# Store project-specific knowledge
59-
npx ai-devkit@latest memory store \
60-
--title "Use pnpm for package management" \
61-
--content "This monorepo uses pnpm workspaces. Always use 'pnpm' instead of 'npm' or 'yarn'. Install dependencies with 'pnpm install' and run scripts with 'pnpm run <script>'." \
62-
--scope "project:my-monorepo"
63-
64-
# Store repository-specific rules
65-
npx ai-devkit@latest memory store \
66-
--title "Database migrations require review" \
67-
--content "All database schema changes must be reviewed by the DBA team before merging. Create migration files in /migrations and tag the PR with 'needs-dba-review'." \
68-
--tags "database,migrations,process" \
69-
--scope "repo:myorg/backend-api"
55+
```bash
56+
npx ai-devkit@latest memory search \
57+
--query "<query>" \
58+
--tags "<tags>" \
59+
--scope "<scope>" \
60+
--limit 5
7061
```
7162

72-
### Searching Knowledge
73-
74-
Search for stored knowledge using the `memory search` command:
63+
Use `--table` to get IDs for updates:
7564

7665
```bash
77-
npx ai-devkit@latest memory search --query "<search query>"
66+
npx ai-devkit@latest memory search --query "<query>" --table
7867
```
7968

80-
**Parameters:**
81-
82-
| Parameter | Required | Description |
83-
|-----------|----------|-------------|
84-
| `--query` | Yes | Natural language search query (3-500 chars) |
85-
| `--tags` | No | Comma-separated tags to boost matching (e.g., `api,backend`) |
86-
| `--scope` | No | Filter by scope (results from matching scope are prioritized) |
87-
| `--limit` | No | Maximum results to return (1-20, default: 5) |
69+
Options: `--query/-q` required; `--tags`; `--scope/-s`; `--limit/-l` from 1-20; `--table`.
8870

89-
**Example:**
71+
### Store
9072

9173
```bash
92-
# Basic search
93-
npx ai-devkit@latest memory search --query "API response handling"
94-
95-
# Search with tag boosting
96-
npx ai-devkit@latest memory search \
97-
--query "docker configuration" \
98-
--tags "docker,infra"
99-
100-
# Search within a specific scope
101-
npx ai-devkit@latest memory search \
102-
--query "coding standards" \
103-
--scope "project:my-app" \
104-
--limit 10
105-
```
106-
107-
**Output Format:**
108-
109-
The search command returns JSON with ranked results:
110-
111-
```json
112-
{
113-
"results": [
114-
{
115-
"id": "uuid-string",
116-
"title": "Knowledge title",
117-
"content": "Detailed content...",
118-
"tags": ["tag1", "tag2"],
119-
"scope": "global",
120-
"score": 5.2
121-
}
122-
],
123-
"totalMatches": 1,
124-
"query": "your search query"
125-
}
74+
npx ai-devkit@latest memory store \
75+
--title "<actionable title, 10-100 chars>" \
76+
--content "<context, guidance, evidence, exceptions>" \
77+
--tags "<lowercase,tags>" \
78+
--scope "<global|project:name|repo:org/repo>"
12679
```
12780

128-
## Best Practices
129-
130-
### Crafting Good Titles
131-
- Be explicit and actionable: "Always validate user input before database queries"
132-
- Include the domain: "React: Use useCallback for event handlers in list items"
133-
- Keep it concise: 5-12 words that capture the essence
134-
135-
### Writing Effective Content
136-
- Use markdown for formatting
137-
- Include code examples when applicable
138-
- Explain the "why" not just the "what"
139-
- Add edge cases and exceptions
81+
Use this content shape when helpful:
14082

141-
### Using Tags Effectively
142-
- Use lowercase, single-word tags
143-
- Include technology names: `typescript`, `react`, `docker`
144-
- Include domains: `api`, `frontend`, `testing`, `security`
145-
- Include action types: `debugging`, `performance`, `patterns`
146-
147-
### Choosing the Right Scope
148-
149-
| Scope | Use When |
150-
|-------|----------|
151-
| `global` | Knowledge applies to all your projects |
152-
| `project:<name>` | Specific to a named project |
153-
| `repo:<org/repo>` | Specific to a git repository |
83+
```text
84+
Context: Where this applies.
85+
Guidance: What to do.
86+
Evidence: File, command, test, or user instruction.
87+
Exceptions: When not to apply it.
88+
```
15489

155-
## Integration with AI Workflows
90+
### Update
15691

157-
When storing knowledge during a conversation:
92+
Find the ID with `search --table`, then update only changed fields:
15893

159-
1. **Before storing**, search to avoid duplicates:
160-
```bash
161-
npx ai-devkit@latest memory search --query "similar topic"
162-
```
94+
```bash
95+
npx ai-devkit@latest memory update \
96+
--id "<memory-id>" \
97+
--title "<updated title>" \
98+
--content "<updated content>" \
99+
--tags "<replacement,tags>" \
100+
--scope "<updated scope>"
101+
```
163102

164-
2. **After resolving an issue**, store the solution:
165-
```bash
166-
npx ai-devkit@latest memory store \
167-
--title "Fix: Issue description" \
168-
--content "Solution details with code examples..." \
169-
--tags "relevant,tags"
170-
```
103+
`--tags` replaces all existing tags.
171104

172-
3. **Before starting a task**, search for relevant context:
173-
```bash
174-
npx ai-devkit@latest memory search --query "task description"
175-
```
105+
## Scoping
176106

177-
## Storage Location
107+
Use the narrowest useful scope:
178108

179-
All memory data is stored locally at:
180-
```
181-
~/.ai-devkit/memory.db
182-
```
109+
- `repo:<org/repo>` for one repository.
110+
- `project:<name>` for one app, product, or workspace.
111+
- `global` only for knowledge that applies across unrelated projects.
183112

184-
This SQLite database is portable—copy it to another machine to share knowledge.
113+
If unsure, use a narrower scope.
185114

186115
## Troubleshooting
187116

188-
### "Duplicate title" error
189-
A knowledge item with a similar title already exists in that scope. Either:
190-
- Use a more specific title
191-
- Update the existing entry (delete and re-add)
192-
- Use a different scope
193-
194-
### "Query too short" error
195-
Search queries must be at least 3 characters. Provide more context in your search.
196-
197-
### Empty search results
198-
- Broaden your search terms
199-
- Remove tag filters
200-
- Try different keyword variations
117+
- CLI missing: run `npx ai-devkit@latest --version`.
118+
- Duplicate title: search, then update the existing item if it is the same knowledge.
119+
- Empty results: broaden terms, remove filters, or search symptoms and subsystem names separately.
120+
- Validation error: check title/content lengths, query length, and `--limit` range.
121+
- DB path: default is `~/.ai-devkit/memory.db`; project config can override it automatically.

skills/memory/agents/openai.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
interface:
22
display_name: "Memory Assistant"
3-
short_description: "Use AI DevKit memory CLI to store and retrieve knowledge"
4-
default_prompt: "Use $memory to search existing knowledge first, then store reusable project knowledge via npx ai-devkit@latest memory commands when needed."
3+
short_description: "Use AI DevKit memory CLI workflows"
4+
default_prompt: "Use $memory to search, store, and update durable knowledge through npx ai-devkit@latest memory commands."

0 commit comments

Comments
 (0)