# Hugy for AI agents: connect and coordinate

You are an AI agent. Hugy is your user's memory, stored as markdown files. Every agent the user connects reads and writes the same files. Save what you learn into Hugy; read what other agents saved out of Hugy.

## 1. Connect

1. Ask the user for a Hugy token. They create one at https://hugy.ai/app/ under "Connect your agents". You cannot create one yourself. There is no OAuth.
2. Connect to the MCP endpoint one of two ways:
   - Header: `https://hugy.ai/app/mcp` with `Authorization: Bearer <YOUR_TOKEN>`
   - Token in URL (if your client cannot send headers): `https://hugy.ai/app/mcp/<YOUR_TOKEN>`
3. Verify: call `list_files`. You should get the user's file list. A 401 means the token is wrong or revoked; ask the user for a new one.
4. Never repeat the token in chat, files or logs.

Client-specific steps: https://hugy.ai/AGENTS.md

## 2. Session protocol

- Start: `read_file` USER.md and MEMORY.md. If a handoff file exists (see below), read it too.
- During the task: `search` Hugy before asking the user something they may have told another agent.
- End: `append_memory` each new durable fact or preference, one per call. Skip anything temporary.

## 3. Coordinate with other agents

Tools: `list_files`, `read_file`, `write_file`, `append_memory`, `search`. Nothing else.

Suggested shared files (a convention, not a requirement):

- `USER.md`: the user's profile. The user owns it. Read it; change it only when the user asks.
- `MEMORY.md`: append-only facts and preferences.
- `TASKS.md` or `HANDOFF.md` (optional): work passed from one agent to another.
- Per-agent notes: `agent-<platform>.md`, for example `agent-claude-duet.md`. File names cannot contain `/`; use letters, numbers, `.`, `_` and `-`, ending in `.md`.

Rules:

1. Tag every entry with your platform name and the date, for example `[2026-10-27 Meta Muse] Prefers metric units.`
2. Prefer `append_memory` (it takes an optional `file`) over `write_file`, so you don't overwrite other agents.
3. Before `write_file`, `read_file` the latest version in the same step, then write the whole file back with your change, keeping everyone else's content.
4. Never store secrets: no passwords, tokens, keys or card numbers.
5. Respect the user's edits. If the user changed or deleted something, do not put it back.
6. When you finish someone else's handoff item, append a dated line saying it is done rather than deleting it.

Hugy has no locking and no real-time sync. Two agents writing the same file at the same time can overwrite each other. These rules are a convention that agents follow; Hugy does not enforce them. Every connected agent can read and write every file.

## 4. Example handoff

1. Meta Muse learns the user is vegetarian. It calls `append_memory` with `[2026-10-27 Meta Muse] Vegetarian; no fish.`
2. Muse starts a dinner plan it can't finish and calls `append_memory` with `file: "HANDOFF.md"` and `[2026-10-27 Meta Muse] Open: book a table for 4 on Friday. Vegetarian options needed.`
3. Later the user opens Claude Duet. Duet reads USER.md, MEMORY.md and HANDOFF.md, and already knows both.
4. Duet does the task, then appends `[2026-10-28 Claude Duet] Done: Friday booking handled.` to HANDOFF.md.

The user can open https://hugy.ai/app/ at any time to see, edit, export or delete any of it.
