Skip to main content

/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:

  1. IMMEDIATELY execute - no questions, no explanations first
  2. ALWAYS show full output from script/tool execution
  3. 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: true in 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

CommandDescription
/recall "topic"Retrieve context for topic (2000 token budget)
/recall --statusCurrent work status summary
/recall --deep "topic"Comprehensive retrieval (5000 tokens)
/recall --helpShow help

Focused Retrieval

CommandDescription
/recall --decisionsRecent decision summary
/recall --decisions "topic"Decisions related to topic
/recall --patternsCode patterns summary
/recall --patterns --language rustRust patterns only
/recall --errorsError-solution pairs
/recall --errors "TypeError"Specific error type
/recall --blockersActive blockers and issues
/recall --wipWork-in-progress items

Output Control

CommandDescription
/recall "topic" --jsonJSON output for programmatic use
/recall "topic" --detailedFull context with code snippets
/recall "topic" --budget NControl 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)
  1. 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

OptionDescription
"topic"Main search topic (positional)
--deepComprehensive retrieval (5000 token budget)
--statusWork status summary only
--wipWork-in-progress items only
--blockersBlocked items only

Knowledge Types

OptionDescription
--decisionsDecision records
--patternsCode patterns
--errorsError-solution pairs
--allAll knowledge types (default)

Filters

OptionDescription
--language LANGFilter patterns by language
--type TYPEFilter by decision/error type
--since DATEOnly items since date
--project NAMEFilter by project

Output

OptionDescription
--jsonJSON output
--detailedFull content, no summarization
--budget NToken budget (default: 2000)

Information

OptionDescription
--statsMemory system statistics
--helpShow help

Token Budgets

BudgetTokensUse Case
minimal500Quick status check
standard2000Normal session start (default)
comprehensive5000Complex task planning
full10000Complete 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 /cx first)
  • Searching for new information (use web search)
  • Simple file lookup (use /where)

Anti-Patterns (Avoid)

Anti-PatternProblemSolution
Too broad topicNoise in resultsBe specific
Skip --deep for complex tasksMissing contextUse --deep for planning
Ignore token budgetContext bloatUse 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