You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Droid doesn't have built-in memory between sessions, but you can create a powerful memory system using markdown files, AGENTS.md references, and hooks. This guide shows you how to build memory that persists and grows.
8
8
9
+
<Info>
10
+
**Works with Factory App:** These memory patterns work identically in both CLI and [Factory App](/web/getting-started/overview)—just ensure your working directory is set to your repository root.
11
+
</Info>
12
+
9
13
---
10
14
11
15
## The Memory System Architecture
@@ -220,63 +224,112 @@ Create a hook that helps you capture memories as you work.
220
224
221
225
When you say "remember this:" followed by content, automatically append to memories.
222
226
223
-
Create `~/.factory/hooks/memory-capture.py`:
224
-
225
-
```python
226
-
#!/usr/bin/env python3
227
-
"""
228
-
Captures "remember this:" statements and appends to memories.md
print(json.dumps({'systemMessage': f'✓ Saved to {mem_file}'}))
324
+
break
325
+
except:
326
+
pass
327
+
328
+
if__name__=='__main__':
329
+
main()
330
+
```
331
+
</Tab>
332
+
</Tabs>
280
333
281
334
Make it executable and configure the hook:
282
335
@@ -304,10 +357,47 @@ Add to your hooks configuration via `/hooks`:
304
357
}
305
358
```
306
359
307
-
Now you can say things like:
360
+
**With # prefix:**
361
+
- "#we decided to use Zustand for state management"
362
+
- "##I prefer early returns" (double `##` saves to personal)
363
+
364
+
**With phrase triggers:**
308
365
- "Remember this: we decided to use Zustand for state management"
309
366
- "Note: the auth module uses JWT with 24-hour expiration"
310
-
- "Remember (personal): I prefer early returns"
367
+
368
+
### Alternative: Memory Capture Skill
369
+
370
+
Instead of a hook, you can use a [skill](/cli/configuration/skills) that Droid invokes when you ask to remember something. This gives you more interactive control over categorization.
371
+
372
+
See the [memory-capture skill example](https://github.com/Factory-AI/factory/tree/main/examples/power-user-skills/memory-capture) for a ready-to-use implementation.
373
+
374
+
### Alternative: Custom Slash Command
375
+
376
+
For quick manual capture, create a [custom slash command](/cli/configuration/custom-slash-commands):
377
+
378
+
Create `~/.factory/commands/remember.md`:
379
+
380
+
```markdown
381
+
---
382
+
description: Save a memory to your memories file
383
+
argument-hint: <whattoremember>
384
+
---
385
+
386
+
Add this to my memories file (~/.factory/memories.md):
387
+
388
+
$ARGUMENTS
389
+
390
+
Format it appropriately based on whether it's a preference, decision, or learning. Include today's date.
391
+
```
392
+
393
+
Then use `/remember we chose PostgreSQL for better ACID compliance` to capture memories on demand.
394
+
395
+
<Info>
396
+
**Which approach to choose?**
397
+
-**Hook** — Best for automatic capture without extra steps
398
+
-**Skill** — Best when you want Droid to help categorize and format
399
+
-**Slash Command** — Best for quick manual capture with consistent formatting
Different AI models respond better to different prompting styles. This guide covers model-specific techniques and provides ready-to-use prompt refiner skills.
8
8
9
+
<Info>
10
+
**Works everywhere:** These prompting techniques apply to both CLI and [Factory App](/web/getting-started/overview).
11
+
</Info>
12
+
9
13
---
10
14
11
15
## Universal Prompting Principles
@@ -98,6 +102,10 @@ Claude models excel with structured, explicit instructions and respond particula
98
102
</Step>
99
103
</Steps>
100
104
105
+
<Tip>
106
+
Ready-to-use prompt refiner skills are available in the [examples folder](https://github.com/Factory-AI/factory/tree/main/examples/power-user-skills). Copy them to `~/.factory/skills/` to use them. Learn more about skills in the [Skills documentation](/cli/configuration/skills).
Rules are codified standards that Droid follows every time. Unlike memories (which capture decisions and context), rules define how code should be written. This guide shows you how to organize rules effectively for individuals and teams.
8
8
9
+
<Info>
10
+
**Works with Factory App:** These conventions work identically in both CLI and [Factory App](/web/getting-started/overview)—Droid reads the same `.factory/rules/` files regardless of interface.
11
+
</Info>
12
+
9
13
---
10
14
11
15
## Rules vs Other Configuration
@@ -588,6 +592,60 @@ When a rule becomes outdated:
588
592
589
593
---
590
594
595
+
## Enforcing Rules Automatically
596
+
597
+
While Droid follows rules from your `.factory/rules/` files, you can add automated enforcement with [hooks](/cli/configuration/hooks-guide).
598
+
599
+
### Run Linters After Edits
600
+
601
+
Add a PostToolUse hook to run your linter after every file edit:
0 commit comments