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

# Reflect documentation

> Connect Reflect to your agent harness to capture conversations and add scoped corrections for recurring AI agent mistakes.

Reflect helps you correct recurring agent mistakes without growing the system prompt
for every conversation. Your harness sends the original conversation to Reflect and
asks for relevant guidance before starting a user turn. When a correction matches,
your code appends that guidance to the next model request's system prompt.

Your **agent harness** is the code that assembles prompts, calls the model, executes
tools, and continues until the turn finishes. You add the SDK at those existing
boundaries. Your harness keeps control of the loop, model provider, retries,
streaming, and cancellation.

## Where Reflect fits

```mermaid theme={null}
flowchart TD
  A[User message enters your harness] --> B[Snapshot original conversation]
  B -. Background capture .-> M[Reflect]
  B --> C[Retrieve optional context]
  M --> C
  C --> D[Assemble this turn's prompt]
  D --> E[Your model and tool loop]
  E --> F[Record original responses and tool results]
  F -. Final capture .-> M
```

| Integration point | What you add |
| - | - |
| Original-history logging | Capture uploads a full snapshot in the background. |
| Before the user turn's model/tool loop | Context retrieval returns optional text within a bounded wait; your code assembles the prompt. |
| After the last response, tool result, or stream event | A final capture records how the execution ended. |

Keep two things separate: the **original conversation** you store and capture, and
the **augmented prompt** sent to the model. Returned context belongs only in the
second. Empty context means your harness uses its original prompt.

> [card] [TypeScript quickstart](https://usereflect.dev/docs/quickstart.md)
>
> Install the npm package and connect your agent's prompt and capture hooks.

> [card] [Python quickstart](https://usereflect.dev/docs/quickstart-python.md)
>
> Install the Python source package and connect your existing agent loop.

> [card] [Ruby quickstart](https://usereflect.dev/docs/quickstart-ruby.md)
>
> Install the Ruby gem and connect capture, context, and completion hooks.

> [card] [Map your conversation history](https://usereflect.dev/docs/guides/trace-capture.md)
>
> Preserve messages, tool identities, and conversation continuity.

> [card] [Review a correction](https://usereflect.dev/docs/guides/corrections.md)
>
> Investigate a failure, write guidance, preview its scope, and activate it.

## From captured runs to corrections

Start in [shadow mode](https://usereflect.dev/docs/guides/runtime-modes.md) to verify capture and inspect failures.
You or your coding agent write the correction and choose when to activate it. With
active delivery enabled, eligible guidance can reach later turns without another
application deployment.

Check capture delivery, the actual prompt your harness sends, added turn latency,
and task outcomes separately. Receiving context establishes none of the others.
Use the [integration checks](https://usereflect.dev/docs/guides/agent-harness.md#verify-the-integration) before
expanding a rollout.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.