Skip to content

Commit da1beb2

Browse files
committed
feat(right-agent): add Right Agent integration
Right Agent (https://github.com/onsails/right-agent) runs Claude Code inside OpenShell sandboxes, one Telegram thread per agent. Hindsight is the native, recommended memory provider — selected during `right init`, with auto-retain and auto-recall on every turn. Adds: - integrations.json card (grouped with the other sandboxed-CC peers) - docs-integrations/right-agent.md integration guide - right-agent.svg brand mark
1 parent 2471f01 commit da1beb2

3 files changed

Lines changed: 135 additions & 0 deletions

File tree

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
sidebar_position: 5
3+
title: "Right Agent Persistent Memory with Hindsight | Integration Guide"
4+
description: "Add persistent memory to Right Agent — closed-box AI agents that run Claude Code inside OpenShell sandboxes. One Telegram bot per agent, with a per-chat Claude Code session over a shared, chat-tagged Hindsight bank. Hindsight is the native memory provider, selected during `right init`."
5+
---
6+
7+
# Right Agent
8+
9+
Persistent memory for [Right Agent](https://github.com/onsails/right-agent) using [Hindsight](https://hindsight.vectorize.io).
10+
11+
Right Agent runs [Claude Code](https://docs.anthropic.com/en/docs/claude-code) inside [OpenShell](https://github.com/NVIDIA/OpenShell) sandboxes. Each agent is its own Telegram bot — DMs, groups, and forum topics each get their own Claude Code session, all sharing one chat-tagged Hindsight bank.
12+
13+
Hindsight is the native, recommended memory provider — selected during `right init`. No plugin to install, no sandbox network policy to edit.
14+
15+
## Quick Start
16+
17+
Install Right Agent and run the init wizard:
18+
19+
```bash
20+
curl -LsSf https://raw.githubusercontent.com/onsails/right-agent/master/install.sh | sh
21+
right init
22+
right up
23+
```
24+
25+
`right init` walks you through picking a memory provider. Choose `hindsight` when prompted:
26+
27+
```
28+
? memory provider:
29+
> hindsight — hindsight cloud api (recommended)
30+
file — local MEMORY.md (no cloud dependency)
31+
? hindsight api key: <paste your key, or press Enter to use HINDSIGHT_API_KEY at runtime>
32+
? hindsight bank id (default: my-agent): <press Enter to accept>
33+
```
34+
35+
Get an API key at [Hindsight Cloud](https://ui.hindsight.vectorize.io/signup).
36+
37+
That's it. The agent auto-retains every turn and auto-recalls relevant context on every new message.
38+
39+
## Features
40+
41+
- **Auto-recall** — on every new user message, queries Hindsight for memories tagged with the current Telegram chat and injects them as system context.
42+
- **Auto-retain** — after every turn, queues the conversation for retention. Asynchronous and resilient; never blocks the agent.
43+
- **Explicit tools**`memory_retain`, `memory_recall`, and `memory_reflect` MCP tools for when automatic isn't enough.
44+
- **Per-chat tagging** — DMs, groups, and forum topics share one bank but each conversation only sees its own memories plus untagged globals.
45+
- **Resilient writes** — local SQLite retain queue plus circuit breaker; pending writes replay automatically when Hindsight is reachable again.
46+
- **No plugin, no policy edits** — Hindsight is built into Right Agent's MCP aggregator on the host. The sandbox needs no Hindsight-specific egress rule.
47+
- **Bundled `rightmemory` skill** — tells the agent when to use each tool and what belongs in memory vs. in its identity files (`IDENTITY.md`, `USER.md`, `TOOLS.md`).
48+
49+
## How It Works
50+
51+
### Memory flow
52+
53+
- **On every new user message**, Right Agent recalls memories tagged with the current Telegram chat and injects them into the agent's system prompt under a `## Memory` section. Recalled content is wrapped as untrusted external context to defend against prompt injection from memory writes.
54+
- **After every turn**, the conversation is queued for retention. If Hindsight is unreachable, the entry sits in a local SQLite queue and retries with backoff — the agent never blocks on memory writes.
55+
- **The agent can also call retain, recall, and reflect directly** via the memory MCP tools when automatic behavior isn't enough.
56+
57+
### Per-chat scoping
58+
59+
One Hindsight bank per agent (set at `right init`, defaults to the agent name). Within that bank, every memory is tagged with the originating Telegram chat (`chat:<chat_id>`), and recall queries with `tags_match: "any"` — so a 1:1 DM, a group, and a forum topic each see their own memories plus any untagged globals. Group conversations don't bleed into 1:1s, but the agent keeps a shared baseline of facts that apply everywhere.
60+
61+
### Where the Hindsight client runs
62+
63+
Right Agent's MCP aggregator runs on the host — outside the sandbox — and is the only process that talks to the Hindsight API. Agents inside the sandbox call `memory_retain` / `_recall` / `_reflect` over the aggregator's per-agent MCP endpoint, and the aggregator makes the Hindsight calls from the host. The sandbox network policy needs no Hindsight-specific egress rule, and Hindsight credentials never enter the sandbox.
64+
65+
## Memory Tools
66+
67+
The aggregator exposes three memory tools to every Hindsight-mode agent:
68+
69+
| Tool | Purpose |
70+
|---|---|
71+
| `mcp__right__memory_retain(content, context)` | Save a fact permanently with a short label (`"user preference"`, `"api format"`, etc.). |
72+
| `mcp__right__memory_recall(query)` | Ranked semantic + keyword + graph search across the agent's memory. |
73+
| `mcp__right__memory_reflect(query)` | Deep analysis across memories — synthesize patterns, compare past decisions. |
74+
75+
The bundled `rightmemory` skill tells the agent when to reach for each one and what belongs in memory rather than in the agent's identity files.
76+
77+
## Configuration
78+
79+
`right init` writes the Hindsight configuration into `~/.right/agents/<name>/agent.yaml`:
80+
81+
```yaml
82+
memory:
83+
provider: hindsight
84+
api_key: hs_live_xxxxxxxxxxxxxxxx # or omit to use HINDSIGHT_API_KEY env var
85+
bank_id: my-agent # defaults to the agent name
86+
recall_budget: 8000 # optional, token budget for auto-recall
87+
```
88+
89+
To change any of these later, edit the file and run `right restart <agent>`. To switch an existing agent between providers, run `right agent config <agent>` and re-run the wizard.
90+
91+
### Using an environment variable
92+
93+
If you'd rather keep the API key out of `agent.yaml`, leave `api_key` empty and set `HINDSIGHT_API_KEY` in the environment where `right up` runs:
94+
95+
```bash
96+
export HINDSIGHT_API_KEY=hs_live_xxxxxxxxxxxxxxxx
97+
right up
98+
```
99+
100+
The aggregator reads `HINDSIGHT_API_KEY` at startup and uses it as the fallback for any agent whose `agent.yaml` doesn't set `memory.api_key`.
101+
102+
## Troubleshooting
103+
104+
**`Memory: degraded` shown in `/doctor` or in the Telegram chat.** The resilient client's circuit breaker tripped after repeated upstream errors. Pending retains are queued locally and replay when the circuit closes. Check Hindsight Cloud status and verify the API key is still valid.
105+
106+
**Memories not appearing after restart.** Verify `memory.bank_id` in `~/.right/agents/<name>/agent.yaml` matches the bank you previously wrote to. The default is the agent name; if you edited it manually, restarts pick up the new value and won't see memories under the old bank.
107+
108+
**`HINDSIGHT_API_KEY` ignored.** The `memory.api_key` field in `agent.yaml` takes precedence over the environment variable. Leave `api_key` empty (or remove it) to fall back to `HINDSIGHT_API_KEY`.
109+
110+
**Quota exhausted.** Right Agent surfaces a chat-level notice when Hindsight returns a quota error. Writes are dropped while quota is exhausted; reads keep working. Top up at [Hindsight Cloud](https://ui.hindsight.vectorize.io) and queued retains catch up on the next successful write.
111+
112+
**Switching from `file` to `hindsight` (or vice versa).** Run `right agent config <agent>` and re-run the wizard, then `right restart <agent>`. An existing local `MEMORY.md` is preserved but ignored while in Hindsight mode; switching back surfaces it again.
113+
114+
## Links
115+
116+
- [Right Agent on GitHub](https://github.com/onsails/right-agent)
117+
- [Install guide](https://github.com/onsails/right-agent/blob/master/docs/INSTALL.md)
118+
- [Hindsight Cloud signup](https://ui.hindsight.vectorize.io/signup)

hindsight-docs/src/data/integrations.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@
170170
"link": "/sdks/integrations/nemoclaw",
171171
"icon": "/img/icons/nemoclaw.png"
172172
},
173+
{
174+
"id": "right-agent",
175+
"name": "Right Agent",
176+
"description": "Persistent memory for Right Agent — closed-box AI agents that run Claude Code inside OpenShell sandboxes. One Telegram bot per agent, with a per-chat Claude Code session over a shared, chat-tagged Hindsight bank. Selected during `right init`; auto-retain and auto-recall on every turn.",
177+
"type": "official",
178+
"by": "hindsight",
179+
"category": "framework",
180+
"link": "/sdks/integrations/right-agent",
181+
"icon": "/img/icons/right-agent.svg"
182+
},
173183
{
174184
"id": "strands",
175185
"name": "Strands Agents",
Lines changed: 7 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)