/recall - Intelligent Memory Retrieval
Retrieve relevant prior work context from the CODITECT memory system. Optimizes for signal-to-noise ratio and token efficiency, surfacing decisions, patterns, errors, and work status related to your current task.
Usage
# Basic topic retrieval
/recall "authentication"
/recall "database migration"
# Quick work status
/recall --status
# Deep context retrieval
/recall --deep "API design"
# Focused retrieval
/recall --decisions "technology choice"
/recall --patterns --language python
/recall --errors "TypeError"
/recall --blockers
# Output formats
/recall "topic" --json
/recall "topic" --detailed
# Token budget control
/recall "topic" --budget 500 # Minimal
/recall "topic" --budget 5000 # Comprehensive
System Prompt
System Prompt
⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:
- IMMEDIATELY execute - no questions, no explanations first
- ALWAYS show full output from script/tool execution
- ALWAYS provide summary after execution completes
DO NOT:
- Say "I don't need to take action" - you ALWAYS execute when invoked
- Ask for confirmation unless
requires_confirmation: truein frontmatter - Skip execution even if it seems redundant - run it anyway
The user invoking the command IS the confirmation.
You are retrieving relevant context from the CODITECT long-term memory system.
Script: scripts/memory-retrieval.py
Databases (ADR-118):
context-storage/org.db(Tier 2: decisions, skill_learnings, error_solutions)context-storage/sessions.db(Tier 3: messages, token_economics)
Execute the memory retrieval:
python3 scripts/memory-retrieval.py $ARGS
First-time setup: If database doesn't exist, run /cx first to build the memory system.
Quick Reference
Basic Operations
| Command | Description |
|---|---|
/recall "topic" | Retrieve context for topic (2000 token budget) |
/recall --status | Current work status summary |
/recall --deep "topic" | Comprehensive retrieval (5000 tokens) |
/recall --help | Show help |
Focused Retrieval
| Command | Description |
|---|---|
/recall --decisions | Recent decision summary |
/recall --decisions "topic" | Decisions related to topic |
/recall --patterns | Code patterns summary |
/recall --patterns --language rust | Rust patterns only |
/recall --errors | Error-solution pairs |
/recall --errors "TypeError" | Specific error type |
/recall --blockers | Active blockers and issues |
/recall --wip | Work-in-progress items |
Output Control
| Command | Description |
|---|---|
/recall "topic" --json | JSON output for programmatic use |
/recall "topic" --detailed | Full context with code snippets |
/recall "topic" --budget N | Control token budget |
Examples
Starting a New Task
# Get context before starting work
/recall "user authentication"
# Output:
## Prior Context Summary (1847 tokens)
**Work Status:**
- [IN_PROGRESS] Auth service refactor - 60% (2 days ago)
- [COMPLETED] JWT implementation (last week)
**Relevant Decisions:**
1. JWT with refresh tokens - 24h access, 7d refresh (ADR-005)
2. bcrypt for password hashing - cost factor 12
**Applicable Patterns:**
- auth_middleware pattern (Python)
- token_refresh_handler pattern
**Known Issues:**
- Token expiry race condition - fixed with 5min grace period
Checking Work Status
/recall --status
# Output:
## Work Status Summary
**In Progress (3):**
- Database migration v3 - 70% complete
- API rate limiting - blocked on Redis setup
- User dashboard - design phase
**Blocked (1):**
- Payment integration - awaiting Stripe API keys
**Recently Completed (5):**
- User model refactor (Dec 10)
- Test coverage improvement (Dec 9)
- ...
Finding Relevant Decisions
/recall --decisions "database"
# Output:
## Database Decisions
1. **PostgreSQL over MongoDB** (ADR-003)
- Rationale: ACID compliance, complex queries
- Date: 2025-11-15
- Relevance: 0.94
2. **Connection pooling with PgBouncer**
- Rationale: Handle 1000+ concurrent connections
- Date: 2025-11-20
- Relevance: 0.87
3. **Schema versioning with Alembic**
- Rationale: Reproducible migrations
- Date: 2025-11-18
- Relevance: 0.82
Finding Code Patterns
/recall --patterns --language python
# Output:
## Python Patterns
1. **async_handler** - Async request handling with error recovery
```python
async def handler(request):
try:
result = await process(request)
return Response(result)
except Exception as e:
logger.error(f"Handler error: {e}")
return ErrorResponse(500)
- repository_base - Data access abstraction
class Repository(Generic[T]):
async def get(self, id: str) -> T: ...
async def save(self, entity: T) -> None: ...
### Finding Error Solutions
```bash
/recall --errors "connection pool"
# Output:
## Error Solutions: Connection Pool
1. **ConnectionPoolExhausted**
- Error: `pool exhausted, no connections available`
- Solution: Increase max_connections to 20, add connection timeout
- Code:
```python
pool = await asyncpg.create_pool(
max_size=20,
command_timeout=30
)
```
- Success rate: 100% (3 occurrences)
Deep Context for Complex Task
/recall --deep "implement payment system"
# Output:
## Comprehensive Context Report (4823 tokens)
### Work Status
- [BLOCKED] Payment integration - awaiting Stripe keys
- [COMPLETED] Pricing model design
- [PLANNED] Subscription management
### Decision History
1. **Stripe over PayPal** (ADR-007)
- Rationale: Better API, lower fees, webhook support
- Alternatives considered: PayPal, Square, Braintree
- Decision date: 2025-11-25
### Architecture Notes
- Payment service isolated in `services/payment/`
- Event-driven with webhooks
- Idempotency keys for all mutations
### Code Patterns
[Full implementations...]
### Related Errors
[Previous payment-related issues...]
### Expand Available
- /recall --expand decisions
- /recall --expand patterns
- /recall --expand errors
JSON Output for Automation
/recall "authentication" --json
# Output:
{
"retrieval_id": "mem_20251212_143022",
"topic": "authentication",
"token_count": 1847,
"work_status": [...],
"decisions": [...],
"patterns": [...],
"errors": [...],
"relevance_summary": {
"high": 3,
"medium": 5,
"low": 2
}
}
Options
Topic & Scope
| Option | Description |
|---|---|
"topic" | Main search topic (positional) |
--deep | Comprehensive retrieval (5000 token budget) |
--status | Work status summary only |
--wip | Work-in-progress items only |
--blockers | Blocked items only |
Knowledge Types
| Option | Description |
|---|---|
--decisions | Decision records |
--patterns | Code patterns |
--errors | Error-solution pairs |
--all | All knowledge types (default) |
Filters
| Option | Description |
|---|---|
--language LANG | Filter patterns by language |
--type TYPE | Filter by decision/error type |
--since DATE | Only items since date |
--project NAME | Filter by project |
Output
| Option | Description |
|---|---|
--json | JSON output |
--detailed | Full content, no summarization |
--budget N | Token budget (default: 2000) |
Information
| Option | Description |
|---|---|
--stats | Memory system statistics |
--help | Show help |
Token Budgets
| Budget | Tokens | Use Case |
|---|---|---|
| minimal | 500 | Quick status check |
| standard | 2000 | Normal session start (default) |
| comprehensive | 5000 | Complex task planning |
| full | 10000 | Complete project history |
Integration
With Orchestrators
Orchestrators automatically call /recall during planning phase to ensure plans account for prior work.
With Session Hooks
The pre-session-memory hook can auto-run /recall at session start based on detected context.
With /cxq
/recall builds on /cxq but adds:
- Intelligent relevance scoring
- Token-efficient summarization
- Work status awareness
- Hierarchical output
Workflow
Session Start
# Check what's relevant to today's work
/recall "today's task topic"
Before Planning
# Ensure you know prior decisions
/recall --decisions "feature area"
When Stuck
# Find if similar issues were solved
/recall --errors "error message"
End of Day
# Update memory for next session
/export && /cx
Success Output
When memory retrieval completes:
✅ COMMAND COMPLETE: /recall
Topic: <search-topic>
Results: N items
Token Count: X
Categories: decisions, patterns, errors, status
Relevance: High (N), Medium (M), Low (L)
Completion Checklist
Before marking complete:
- Topic identified
- Memory database queried
- Results ranked by relevance
- Token budget respected
- Summary generated
Failure Indicators
This command has FAILED if:
- ❌ Memory database not found
- ❌ No results returned
- ❌ Token budget exceeded
- ❌ Invalid query
When NOT to Use
Do NOT use when:
- Memory database not initialized (run
/cxfirst) - Searching for new information (use web search)
- Simple file lookup (use
/where)
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Too broad topic | Noise in results | Be specific |
Skip --deep for complex tasks | Missing context | Use --deep for planning |
| Ignore token budget | Context bloat | Use appropriate --budget |
Principles
This command embodies:
- #9 Based on Facts - Historical context retrieval
- #4 Keep It Simple - Token-efficient summaries
Full Standard: CODITECT-STANDARD-AUTOMATION.md
Agent: memory-context-agent
Skill: skills/memory-retrieval/SKILL.md
Script: scripts/memory-retrieval.py
Version: 1.0.0
Last Updated: 2025-12-12