Use this file to discover all available pages before exploring further.
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.
Works with Factory App: These memory patterns work identically in both CLI and Factory App—just ensure your working directory is set to your repository root.
# My Development Memory## Code Style Preferences### General- I prefer functional programming patterns over OOP- I like early returns to reduce nesting- I use 2-space indentation (but defer to project config)### TypeScript- I prefer `interface` over `type` for object shapes- I use strict mode always- I avoid `enum` in favor of `as const` objects### React- Functional components only- I prefer Zustand over Redux for state- I use React Query for server state## Tool Preferences- Package manager: pnpm (prefer) > npm > yarn- Testing: Vitest > Jest- Formatting: Prettier with defaults- Linting: ESLint with strict TypeScript rules## Communication Style- I prefer concise explanations over verbose ones- Show me the code first, explain after if needed- When debugging, show me your reasoning## Past Decisions (Personal Projects)- [2024-01] Switched from Create React App to Vite- [2024-02] Adopted Tailwind CSS as default styling- [2024-03] Using Supabase for personal projects
Add to your ~/.factory/AGENTS.md or project AGENTS.md:
## Personal PreferencesMy coding preferences and tool choices are documented in `~/.factory/memories.md`.Refer to this file when making decisions about code style, architecture, or tooling.
# Project Memory## Project Context- **Name**: Acme Dashboard- **Type**: B2B SaaS application- **Stack**: Next.js 14, TypeScript, Prisma, PostgreSQL- **Started**: January 2024## Architecture Decisions### 2024-01-15: Database Choice**Decision**: PostgreSQL over MongoDB**Reasoning**: Strong relational data model, ACID compliance needed for financial data**Trade-offs**: More rigid schema, but better for reporting queries### 2024-02-01: Authentication Approach**Decision**: NextAuth.js with custom credentials provider**Reasoning**: Need to integrate with existing enterprise LDAP**Implementation**: See `src/lib/auth/` for setup### 2024-02-20: State Management**Decision**: Zustand for client state, React Query for server state**Reasoning**: Simpler than Redux, better separation of concerns**Pattern**: Store files in `src/stores/`, queries in `src/queries/`## Known Technical Debt- [ ] Auth refresh token logic needs refactoring (#234)- [ ] Dashboard queries should be optimized with proper indexes- [ ] Legacy API endpoints in `/api/v1/` need deprecation## Domain Knowledge### Business Rules- Users belong to Organizations (multi-tenant)- Subscription tiers: Free, Pro, Enterprise- Free tier limited to 3 team members- Data retention: 90 days for Free, unlimited for paid### Key Entities- `User`: Individual accounts, can belong to multiple orgs- `Organization`: Tenant container, has subscription- `Project`: Work container within an org- `Task`: Work items within projects## Team Conventions- PR titles follow conventional commits- All PRs need at least one approval- Deploy to staging on merge to `develop`- Deploy to production on merge to `main`
## Project MemoryArchitecture decisions, domain knowledge, and project history are documented in `.factory/memories.md`.Always check this file before making significant architectural or design decisions.
When you say “remember this:” followed by content, automatically append to memories.You can trigger memory capture with either special characters or phrases. Choose based on your preference:
# prefix trigger
Phrase trigger
Trigger with # at the start of your message for quick capture.Usage:
“#we use the repository pattern”
“##I prefer early returns” (double ## for personal)
Create ~/.factory/hooks/memory-capture.py:
#!/usr/bin/env python3"""Captures messages starting with # and appends to memories.md"""import json, sys, osfrom datetime import datetimedef main(): try: data = json.load(sys.stdin) prompt = data.get('prompt', '').strip() if not prompt.startswith('#'): return # ## = personal, # = project if prompt.startswith('##'): content = prompt[2:].strip() mem_file = os.path.expanduser('~/.factory/memories.md') else: content = prompt[1:].strip() project_dir = os.environ.get('FACTORY_PROJECT_DIR', os.getcwd()) project_factory = os.path.join(project_dir, '.factory') if os.path.exists(project_factory): mem_file = os.path.join(project_factory, 'memories.md') else: mem_file = os.path.expanduser('~/.factory/memories.md') if content: timestamp = datetime.now().strftime('%Y-%m-%d') with open(mem_file, 'a') as f: f.write(f"\n- [{timestamp}] {content}\n") print(json.dumps({'systemMessage': f'✓ Saved to {mem_file}'})) except: passif __name__ == '__main__': main()
Trigger with phrases like “remember this:”, “note:”, etc.Usage:
“Remember this: we use the repository pattern”
“Note: auth tokens expire after 24 hours”
Create ~/.factory/hooks/memory-capture.py:
#!/usr/bin/env python3"""Captures 'remember this:' statements and appends to memories.md"""import json, sys, osfrom datetime import datetimedef main(): try: data = json.load(sys.stdin) prompt = data.get('prompt', '') triggers = ['remember this:', 'remember:', 'note:', 'save this:'] for trigger in triggers: if trigger in prompt.lower(): idx = prompt.lower().index(trigger) content = prompt[idx + len(trigger):].strip() if content: # Personal if specified, otherwise project if 'personal' in prompt.lower(): mem_file = os.path.expanduser('~/.factory/memories.md') else: project_dir = os.environ.get('FACTORY_PROJECT_DIR', os.getcwd()) project_factory = os.path.join(project_dir, '.factory') if os.path.exists(project_factory): mem_file = os.path.join(project_factory, 'memories.md') else: mem_file = os.path.expanduser('~/.factory/memories.md') timestamp = datetime.now().strftime('%Y-%m-%d') with open(mem_file, 'a') as f: f.write(f"\n- [{timestamp}] {content}\n") print(json.dumps({'systemMessage': f'✓ Saved to {mem_file}'})) break except: passif __name__ == '__main__': main()
Instead of a hook, you can use a skill that Droid invokes when you ask to remember something. This gives you more interactive control over categorization.
For quick manual capture, create a custom slash command:Create ~/.factory/commands/remember.md:
---description: Save a memory to your memories fileargument-hint: <what to remember>---Add this to my memories file (~/.factory/memories.md):$ARGUMENTSFormat it appropriately based on whether it's a preference, decision, or learning. Include today's date.
Then use /remember we chose PostgreSQL for better ACID compliance to capture memories on demand.
Which approach to choose?
Hook — Best for automatic capture without extra steps
Skill — Best when you want Droid to help categorize and format
Slash Command — Best for quick manual capture with consistent formatting
When memories become stale, move them to an archive:
# memories.md## Current Decisions[active decisions here]## Archive (2023)<details><summary>Archived decisions from 2023</summary>### 2023-06: Original Auth System**Decision**: Custom JWT implementation**Status**: Replaced by NextAuth.js in 2024-02**Reason for change**: Maintenance burden, security updates</details>
---name: context-aware-implementationdescription: Implement features using project memory and conventions.---# Context-Aware ImplementationBefore implementing any feature:1. **Check project memory** (`.factory/memories.md`): - What architecture decisions apply? - What patterns should I follow? - What constraints exist?2. **Check personal preferences** (`~/.factory/memories.md`): - What code style does the user prefer? - What tools should I use?3. **Check rules** (`.factory/rules/`): - What conventions apply to this file type? - What testing requirements exist?Then implement following all discovered context.