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

# Remember and Recall in One Script

> Store a single passage with remember() and query it back with recall() in the smallest complete Cognee script

A minimal guide to the smallest end-to-end Cognee script. Use it as the starting point for a new project: one passage of text goes in with `remember()`, one question comes back answered with `recall()`, and nothing else is configured.

## Before You Start

* Complete [Quickstart](/getting-started/quickstart) to understand basic operations
* Ensure you have [LLM Providers](/setup-configuration/llm-providers) configured — the answer is generated by a language model
* Read [Remember](/core-concepts/main-operations/remember) and [Recall](/core-concepts/main-operations/recall) for what the two operations do
* No data is required up front — the script ingests its own passage, but it starts with `cognee.forget(everything=True)`, which wipes all existing Cognee data; run it against a setup you can afford to reset

## Code in Action

```python theme={null}
import asyncio

import cognee
from cognee import SearchType
from cognee.shared.logging_utils import ERROR, setup_logging


async def main():
    # Start clean, then remember knowledge with the v1.0 memory API.
    await cognee.forget(everything=True)
    text = """
    Natural language processing (NLP) is an interdisciplinary
    subfield of computer science and information retrieval.
    """

    await cognee.remember(text, self_improvement=False)

    query_text = "Tell me about NLP"
    print(f"Searching cognee for insights with query: '{query_text}'")
    search_results = await cognee.recall(
        query_type=SearchType.GRAPH_COMPLETION, query_text=query_text
    )

    for result_text in search_results:
        print(result_text)


if __name__ == "__main__":
    logger = setup_logging(log_level=ERROR)
    asyncio.run(main())
```

## What Just Happened

### Step 1: Start From a Clean Slate

```python theme={null}
await cognee.forget(everything=True)
```

`forget(everything=True)` deletes every dataset, graph node, embedding, and session-cache entry the current user owns, so the run starts with an empty graph and the answer can only come from the passage below. Leave this line out of your own application — you rarely want to erase everything before storing something new.

### Step 2: Remember the Passage

```python theme={null}
text = """
Natural language processing (NLP) is an interdisciplinary
subfield of computer science and information retrieval.
"""

await cognee.remember(text, self_improvement=False)
```

`remember()` takes raw text and runs the full ingestion workflow on it: the passage is chunked, entities and relationships are extracted, and the result is written to the graph as memory. `self_improvement=False` keeps the run to plain ingestion instead of also running `improve()`.

### Step 3: Recall an Answer

```python theme={null}
query_text = "Tell me about NLP"
print(f"Searching cognee for insights with query: '{query_text}'")
search_results = await cognee.recall(
    query_type=SearchType.GRAPH_COMPLETION, query_text=query_text
)

for result_text in search_results:
    print(result_text)
```

`SearchType.GRAPH_COMPLETION` retrieves the graph triplets relevant to `query_text`, builds a context from them, and asks a language model to answer from that context. `recall()` returns a list, so the loop prints each result — with this small a graph, expect a single answer describing NLP.

### Step 4: Run the Script Quietly

```python theme={null}
if __name__ == "__main__":
    logger = setup_logging(log_level=ERROR)
    asyncio.run(main())
```

Both operations are asynchronous, so `main()` runs under `asyncio.run()`. `setup_logging(log_level=ERROR)` keeps Cognee's own progress logging out of the way, leaving only the printed answer — and any real error — in the output.

<Columns cols={3}>
  <Card title="Remember" icon="brain" href="/core-concepts/main-operations/remember">
    Every way to get data into Cognee memory, and what each option changes.
  </Card>

  <Card title="Recall" icon="search" href="/core-concepts/main-operations/recall">
    Understand recall()'s full parameter surface and auto-routing behavior.
  </Card>

  <Card title="Inspecting Graph Completion Context" icon="route" href="/guides/graph-completion">
    See the triplets GRAPH\_COMPLETION retrieved before it answered.
  </Card>
</Columns>
