> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agents-squads.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Memory

> Give your agents persistent context across sessions

## Why Memory?

Without memory, every session starts fresh. Your agents forget everything.

With memory:

* **Continuity** — Pick up where you left off
* **Learning** — Build on previous work
* **Coordination** — Share context between agents

## Memory Structure

```
.agents/memory/
├── research/              # Squad memory
│   ├── goals.md           # Measurable targets
│   ├── feedback.md        # Last cycle's evaluation
│   └── analyst/
│       └── state.md       # Agent memory
└── company/
    └── strategy.md        # Company-wide "why" — read by every squad
```

See [Memory](/concepts/memory) for how these layers cascade into an agent's
context, in priority order, on every run.

## Querying Memory

```bash theme={null}
# Search across all memory
squads memory query "competitor analysis"

# Read a specific squad's memory
squads memory read research

# List all entries
squads memory list
```

## Memory in Action

When an agent runs:

```
1. Load    → Retrieve relevant memory
2. Inject  → Add to agent context
3. Execute → Agent works with full context
4. Update  → Store new learnings
```

## Writing Good Memory

Memory files are markdown. Keep them structured:

```markdown theme={null}
<!-- .agents/memory/research/analyst/state.md -->

# Research Analyst Memory

## Current Focus
Q1 2025 market analysis for enterprise AI agents.

## Recent Work
- Completed competitive analysis (Jan 15)
- Identified 3 new market entrants
- Pricing research in progress

## Key Findings
- Market growing 15% YoY
- Main competitor raised Series B
- Enterprise buyers want transparency

## Blockers
- Need access to Gartner reports
- Waiting on customer interview data

## Next Steps
- Deep dive on pricing strategies
- Interview customer segment
```

## Memory Types

### Agent Memory

Private to each agent:

* Task history
* Learned preferences
* Work in progress

### Squad Memory

Shared across agents in a squad:

* Domain knowledge
* Coordination state
* Team decisions

## Best Practices

<AccordionGroup>
  <Accordion title="Update memory after work">
    Run `squads memory write <squad> "<learning>"` after significant work.
  </Accordion>

  <Accordion title="Keep it current">
    Stale memory is worse than no memory. Prune outdated info.
  </Accordion>

  <Accordion title="Structure consistently">
    Use the same sections across agents for predictability.
  </Accordion>

  <Accordion title="Focus on context, not logs">
    Memory isn't a log file. Store insights, not events.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="CLI Reference" icon="terminal" href="/cli-reference">
    All memory commands
  </Card>

  <Card title="Core Concepts" icon="lightbulb" href="/concepts/memory">
    Deep dive on memory
  </Card>
</CardGroup>
