From 05d1c562cef5da20a63571689e05adab1d7a35af Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Wed, 2 Dec 2026 19:35:36 +0530 Subject: [PATCH 1/5] docs: correct commands, hooks, MCP, and plugin references --- .github/actions/reflect/action.yml | 11 +- AGENTS.md | 163 ++++++++++---- docs/mcp-servers.md | 118 ++++++----- docs/user-guide/01-getting-started.md | 24 +-- docs/user-guide/03-keyboard-shortcuts.md | 29 ++- docs/user-guide/04-slash-commands.md | 98 +++++---- docs/user-guide/07-mcp-servers.md | 188 ++++++++-------- docs/user-guide/09-plugins.md | 192 ++++++++++------- docs/user-guide/10-hooks.md | 236 ++++++++++----------- docs/user-guide/13-memory.md | 127 ++++------- docs/user-guide/15-agent-mode.md | 141 +++++------- docs/user-guide/17-sessions.md | 5 +- docs/user-guide/23-dashboard.md | 50 +++-- docs/user-guide/24-monitoring-usage.md | 80 +++---- examples/github/reflect-issue-resolver.yml | 18 +- 15 files changed, 786 insertions(+), 694 deletions(-) diff --git a/.github/actions/reflect/action.yml b/.github/actions/reflect/action.yml index 9a966480f..5ee7a3aa3 100644 --- a/.github/actions/reflect/action.yml +++ b/.github/actions/reflect/action.yml @@ -226,7 +226,16 @@ runs: exit 2 fi if [ -n "${REFLECT_INPUT_PROMPT_FILE}" ]; then - args+=(--file "${REFLECT_INPUT_PROMPT_FILE}") + if [ ! -f "${REFLECT_INPUT_PROMPT_FILE}" ]; then + echo "::error::prompt-file not found: ${REFLECT_INPUT_PROMPT_FILE}" >&2 + exit 2 + fi + prompt="$(cat "${REFLECT_INPUT_PROMPT_FILE}")" + if [ -z "${prompt}" ]; then + echo "::error::prompt-file is empty: ${REFLECT_INPUT_PROMPT_FILE}" >&2 + exit 2 + fi + args+=("${prompt}") elif [ -n "${REFLECT_INPUT_PROMPT}" ]; then args+=("${REFLECT_INPUT_PROMPT}") else diff --git a/AGENTS.md b/AGENTS.md index 7e05384e2..57416aaec 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,5 @@ --- -description: Extending reflect — how to write AGENTS.md files, custom specialists, skills, hooks, MCP servers, and plugins. +description: Extending reflect — how to write AGENTS.md files, custom agents, skills, hooks, MCP servers, and plugins. globs: "*.go, *.js, *.md, *.json, *.toml, *.yaml, *.yml" alwaysApply: false --- @@ -50,28 +50,27 @@ Tips: ### Personal guidelines, across every project -For preferences that follow *you*, not a specific repo (tone, tooling habits, workflow), drop a `ZERO.md` in your user config directory: `~/.reflect/ZERO.md` on Linux/macOS, `%AppData%\reflect\ZERO.md` on Windows — the same directory as config files and your personal specialists. Same format and 8 KiB cap as the project files above, and the same case-insensitive basename match. +For preferences that follow *you*, not a specific repo (tone, tooling habits, workflow), drop a `ZERO.md` in your user config directory: `~/.reflect/ZERO.md` on Linux/macOS, `%AppData%\reflect\ZERO.md` on Windows — the same directory as config files and your personal agents. Same format and 8 KiB cap as the project files above, and the same case-insensitive basename match. This file is injected as its own `## User guidelines` section, before the project's `AGENTS.md`/`ZERO.md`, and is labeled as personal preference in the prompt: project guidelines are the later, more specific instruction and take precedence over it when the two conflict. -## 2. Custom specialists +## 2. Custom agents (personas) -Specialists are reflect's sub-agents. Three scopes, in priority order: +Custom agents are Reflect's user-defined sub-agent personas. They live in one +place only — Reflect user state: -| Scope | Path | Shared? | -| --- | --- | --- | -| Built-in | compiled into reflect | yes | -| User | `~/.reflect/specialists/*.md` | no — your machine only | -| Project | `./.zero/specialists/*.md` | yes — the repo team | - -Project overrides user overrides built-in when names collide. +```text +~/.reflect/agents/*.md +``` -A specialist is a markdown manifest with frontmatter and a system prompt: +There is no project scope and no built-in/user/project override chain. A persona +is a markdown file with frontmatter and a system prompt: ```markdown --- +name: api-reviewer description: Reviews API changes for breaking-change risk and missing tests. -tools: read-only,plan +model: inherit --- You review API changes. For every changed hunk in `internal/api/` or any file @@ -86,37 +85,39 @@ that ends in `_api.go`: Reply with one JSON object per finding: `{"file", "line", "severity", "message", "fix"}`. ``` +Frontmatter supports `name`, `description`, and `model` (`inherit` uses the +session model). There is no `tools` field. Use the persona with +`reflect exec --agent api-reviewer` or the agent picker in the TUI. + CLI management: ```bash -reflect specialist list -reflect specialist show api-reviewer -reflect specialist create api-reviewer \ - --project \ - --description "Reviews API changes" \ - --tools read-only,plan \ - --prompt "$(cat api-reviewer.md)" -reflect specialist edit api-reviewer --project -reflect specialist delete api-reviewer --project -reflect specialist path # prints the resolved specialists directory +reflect agent list +reflect agent show api-reviewer +reflect agent create api-reviewer --description "Reviews API changes" +reflect agent remove api-reviewer ``` ## 3. Skills reflect ships **no bundled skills** by default. Skills are markdown instruction -files that extend agent capabilities, sourced from the separate -`GrayCodeAI/graycode-skills` repo and installed on demand: +files that extend agent capabilities, installed from any public GitHub +repository on demand: ```bash -reflect skills search # find skills in graycode-skills -reflect skills install [skill-name] # install after user approval +reflect skills install [skill-name] # install all or one skill reflect skills list # list installed skills reflect skills remove +reflect skills info # details for an installed skill ``` Installed skills live in user or project scope: - User-scoped: `~/.reflect/skills/` -- Project-scoped: `./.zero/skills/` or `./skills/` +- Project-scoped: Reflect's project state directory under `skills/` + +`reflect skills search` and `reflect skills trending` read a community index; +there is no published index at this time, so treat those subcommands as +unavailable and install directly from a repository you trust. A skill manifest: @@ -137,47 +138,117 @@ When reviewing Go code for security: ## 4. Hooks -Hooks allow custom commands to run at specific lifecycle points: -- `beforeReview` — runs before code review starts -- `afterReview` — runs after code review completes -- `sessionStart` — runs at session initialization -- `sessionEnd` — runs at session teardown +Hooks run a command when a Reflect lifecycle event fires. They are file-based +only — there is no `reflect hook` CLI. Create one Markdown file per hook under +`.reflect/hooks/`: -```bash -reflect hook add beforeReview --command "lint-check" -reflect hook remove beforeReview -reflect hook list +```markdown +--- +name: format-go +event: PostToolUse +pattern: "*.go" +command: ./scripts/gofmt-changed.sh +timeout: 30 +async: true +--- + +Optional notes; Reflect reads the YAML frontmatter. ``` +Frontmatter fields: `name` (defaults to the file name), `event` (required), +`command` (required), `pattern` (glob matched against a payload `path`), +`timeout` (seconds, default 30), and `async`. The command is executed directly, +not through a shell, so use a script for pipes or `&&`. + +Canonical events include `session_start`, `user_prompt_submit`, `pre_tool`, +`post_tool`, `post_tool_failure`, `pre_compact`/`post_compact`, `file_changed`, +`permission_ask`/`permission_result`, `subagent_start`/`subagent_stop`, +`task_started`, `session_heartbeat`, `stop`/`stop_failure`, `failure`, +`interrupt`, `notification`, and `test_result`. Vendor spellings such as +`PreToolUse` are normalized to the same events. + +Hooks load from `.reflect/hooks/`, `.agents/hooks/`, and `.claude/hooks/` +(project, trust required), plus Reflect's user state and config `hooks/` +directories. Show what loaded with `/hooks` in the TUI. See +[docs/user-guide/10-hooks.md](docs/user-guide/10-hooks.md). + ## 5. MCP integration -MCP (Model Context Protocol) servers can expose tools to reflect: +MCP servers are configured as an array in `settings.json` (global +`~/.reflect/settings.json`, project `.reflect/settings.json`): + +```json +{ + "mcp_servers": [ + { + "name": "filesystem", + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"], + "type": "stdio" + }, + { + "name": "linear", + "type": "http", + "url": "https://mcp.linear.app/mcp", + "headers": { "Authorization": "Bearer " } + } + ] +} +``` + +Fields are `name`, `command`, `args`, `type` (`stdio`, `sse`, `http`, +`websocket`), `url`, `headers`, and `client_id`. There is no `enabled` or `env` +field; stdio servers inherit Reflect's environment. Project servers load only +after the folder is trusted. Tools are exposed as `mcp____`. + +The `reflect mcp` command only covers Reflect acting as an MCP server for +another client: ```bash -reflect mcp add --name server --url http://localhost:8080 -reflect mcp remove server -reflect mcp list +reflect mcp serve # run Reflect as an MCP server over stdio +reflect mcp config # print the client configuration block ``` +See [docs/mcp-servers.md](docs/mcp-servers.md). + ## 6. Plugins -Plugins extend reflect with custom tools and capabilities: +Plugins bundle tools, hooks, skills, and MCP servers into one installable unit. +The command is `reflect plugin` (singular): ```bash -reflect plugin add --name my-plugin --path ./my-plugin -reflect plugin remove my-plugin reflect plugin list +reflect plugin install owner/repo +reflect plugin install /path/to/local/plugin +reflect plugin inspect my-plugin +reflect plugin activate my-plugin +reflect plugin deactivate my-plugin +reflect plugin reload my-plugin +reflect plugin status +reflect plugin logs my-plugin +reflect plugin uninstall my-plugin +reflect plugin create my-plugin +reflect plugin marketplace list ``` +A plugin is a directory with a `plugin.json` manifest plus optional `skills/`, +`hooks/`, and `mcp.json` components. User plugins live in `~/.reflect/plugins/`; +project plugins live in `.reflect/plugins/` and require folder trust. See +[docs/user-guide/09-plugins.md](docs/user-guide/09-plugins.md). + ## 7. Verification -reflect includes a self-verification system to validate local changes before contributing: +reflect includes local self-verification that runs without a model: ```bash reflect verify -reflect verify --fix ``` +It checks the tamper-evident security event log hash chain, validates the +managed governance policy when one is installed, and runs any project +test/verify commands discovered in the workspace. It exits non-zero on the +first failure. There is no `--fix` flag. + ## Development ```bash diff --git a/docs/mcp-servers.md b/docs/mcp-servers.md index 93562c12b..abf87e36d 100644 --- a/docs/mcp-servers.md +++ b/docs/mcp-servers.md @@ -1,10 +1,12 @@ # MCP Server Configuration -reflect supports connecting to external MCP (Model Context Protocol) servers to extend its capabilities with additional tools, resources, and prompts. +reflect connects to external MCP (Model Context Protocol) servers to extend its +capabilities with additional tools. ## Configuration -MCP servers are configured in `settings.json` (global: `~/.reflect/settings.json`, project: `.reflect/settings.json`). +MCP servers are configured under the `mcp_servers` array in `settings.json` +(global: `~/.reflect/settings.json`, project: `.reflect/settings.json`). ```json { @@ -24,85 +26,97 @@ MCP servers are configured in `settings.json` (global: `~/.reflect/settings.json | Field | Type | Required | Description | |-------|------|----------|-------------| | `name` | string | Yes | Unique identifier for the server | -| `command` | string | Yes | Executable name or path (stdio mode) | +| `command` | string | stdio only | Executable name or path | | `args` | string[] | No | Arguments passed to the command | -| `type` | string | No | Transport type: `stdio` (default), `sse`, `http` | -| `url` | string | No | URL for SSE/HTTP transports | -| `headers` | map | No | Custom HTTP headers for SSE/HTTP transports | +| `type` | string | No | Transport: `stdio` (default), `sse`, `http`, `websocket` | +| `url` | string | remote only | URL for remote transports | +| `headers` | map | No | Custom HTTP headers for remote transports | +| `client_id` | string | No | Pre-registered OAuth client id | -## Known MCP Servers +There is no `enabled` or `env` field. A stdio server inherits Reflect's process +environment, so export credentials before starting Reflect. -### My-Jogyo (Scientific Research Lab) +## Transports -My-Jogyo provides 12 MCP tools for scientific research workflows, including Python REPL execution, notebook management, and research session checkpointing. +### stdio (local process) -**Installation:** - -```bash -# Install My-Jogyo -npm install -g my-jogyo - -# Add to reflect settings +```json +{ + "mcp_servers": [ + { + "name": "filesystem", + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"], + "type": "stdio" + } + ] +} ``` -**settings.json:** +### HTTP / SSE (remote server) ```json { "mcp_servers": [ { - "name": "my-jogyo", - "command": "my-jogyo", - "args": ["serve"], - "type": "stdio" + "name": "linear", + "type": "http", + "url": "https://mcp.linear.app/mcp", + "headers": { + "Authorization": "Bearer " + } } ] } ``` -**Available tools:** -- `python_repl` — Execute Python code in a managed REPL -- `research_manager` — Create and manage research sessions -- `gyoshu_snapshot` — Snapshot current research state -- `checkpoint_manager` — Save and restore research checkpoints -- `notebook_writer` — Create and edit Jupyter notebooks -- `notebook_search` — Search notebook contents -- `research_export` — Export research results -- `data_loader` — Load datasets for analysis -- `visualization` — Generate plots and charts -- `environment` — Manage Python environment and packages -- `citation` — Manage research citations -- `session_handoff` — Transfer research context between sessions - -## CLI Management +For OAuth-capable remote servers, set `client_id` only when the provider +requires a pre-registered client. -```bash -# Add an MCP server -reflect mcp add [args...] +## Project Scope and Trust + +Project settings merge over global settings when Reflect starts in that +directory. Project-scoped MCP servers load only after you trust the folder +(`/trust` or `reflect trust add`). -# List configured servers -reflect mcp list +## Tool Naming -# Remove a server -reflect mcp remove +MCP tools are namespaced as: -# Test a server connection -reflect mcp test +```text +mcp____ +``` + +For example, server `filesystem` with tool `read_file` becomes +`mcp__filesystem__read_file`. + +## CLI + +Reflect does not add or remove MCP servers from the CLI. Edit `mcp_servers` in +`settings.json` directly. The `reflect mcp` command only covers Reflect acting +as an MCP server for another client: + +```bash +reflect mcp serve # run Reflect as an MCP server over stdio +reflect mcp config # print the client configuration block ``` ## Troubleshooting **Server fails to start:** -- Verify the command is in PATH: `which ` -- Check the server supports stdio transport -- Run the command manually to check for errors + +- Verify the command is on `PATH`: `which ` +- Run the command manually to see its error output +- Confirm the server supports the transport you configured **Tools not appearing:** -- Restart reflect after adding a new server -- Check `reflect mcp test ` for connection errors -- Verify the server's tools/list response is valid JSON-RPC + +- Restart Reflect after editing `settings.json` +- Check that `name`, `command`/`url`, and `type` are set correctly +- Look for MCP connection warnings on stderr **Timeout errors:** -- Default tool timeout is 30 seconds + +- The default tool timeout is 30 seconds - Long-running tools may need server-side timeout configuration - Check network connectivity for remote servers diff --git a/docs/user-guide/01-getting-started.md b/docs/user-guide/01-getting-started.md index e25a9a1dc..e37b80d78 100644 --- a/docs/user-guide/01-getting-started.md +++ b/docs/user-guide/01-getting-started.md @@ -43,7 +43,7 @@ Start Reflect by running: reflect ``` -On first launch, Reflect opens a TUI where you can configure credentials. Press `/config` (or `/autonomy`) to open the configuration picker. Your API keys are stored in your OS keychain (macOS Keychain or Linux keyring), never in plain text. +On first launch, Reflect opens a TUI where you can configure credentials. Press `/config` to open the configuration picker. Your API keys are stored in your OS keychain (macOS Keychain or Linux keyring), never in plain text. Reflect supports multiple providers: @@ -84,16 +84,16 @@ The `@` operator opens a fuzzy file picker. By default it respects `.gitignore` Reflect exposes two independent control surfaces: -- **`/autonomy`** — Controls the trust tier (Always Ask, Scout, Builder, Operator, Autonomous) +- **`/permission`** — Controls the trust tier (Always Ask, Scout, Builder, Operator, Autonomous) - **`/spec`** — A workflow gate that blocks Write/Edit/Bash until you approve implementation Example: ``` -/autonomy tier builder -/autonomy allow Bash(git:*) -/autonomy deny Bash(rm -rf *) -/autonomy save project +/permission tier builder +/permission allow Bash(git:*) +/permission deny Bash(rm -rf *) +/permission save project ``` --- @@ -104,7 +104,7 @@ Example: Every conversation is a **session**. Sessions are automatically saved and can be resumed later. Each session tracks the full conversation history, tool calls, file edits, and task state. -- Start a new session: `Ctrl+N` or `/new` +- Start a new session: `/new` - Resume a previous session: `/resume` in the TUI, or `--resume ` from the CLI - Continue the most recent session: `reflect -c` @@ -137,7 +137,7 @@ Reflect has built-in tools for: Type `/` in the prompt to access commands. These provide quick actions without writing a full prompt: ``` -/autonomy # Open autonomy picker +/permission # Open the permission center /spec # Start spec workflow /compact # Compress conversation history /model grok-build # Switch model @@ -155,7 +155,7 @@ See [Slash Commands](04-slash-commands.md) for the complete reference. # Start the interactive TUI reflect -# Submit an initial prompt as the first turn +# Run a one-shot prompt and exit reflect "fix the failing auth test and run it" # Start in a specific project directory @@ -170,8 +170,8 @@ reflect -c # Use a specific provider/model reflect --provider openai --model gpt-4o -# Isolated worktree for changes -reflect --worktree "refactor module X" +# Isolated worktree for changes (exec subcommand) +reflect exec --worktree "refactor module X" # Non-interactive (headless) mode reflect -p "Explain this codebase" @@ -180,7 +180,7 @@ reflect -p "Explain this codebase" reflect exec --auto full "add error handling" # Dry-run mode (denies all tools) -reflect exec --autonomy dry-run "What would this do?" +reflect --dry-run "What would this do?" ``` --- diff --git a/docs/user-guide/03-keyboard-shortcuts.md b/docs/user-guide/03-keyboard-shortcuts.md index d13bcb64e..8979b9c65 100644 --- a/docs/user-guide/03-keyboard-shortcuts.md +++ b/docs/user-guide/03-keyboard-shortcuts.md @@ -14,18 +14,11 @@ Reflect has two input modes that control how you navigate the scrollback: Simple mode is active by default. To switch to Vim mode: ``` -/vim-mode +/vim ``` -Or set `vim_mode = true` under `[ui]` in `~/.reflect/settings.json`: - -```json -{ - "ui": { - "vim_mode": true - } -} -``` +`/vim` toggles Vim mode for the current session; it is not persisted across +restarts. --- @@ -85,11 +78,13 @@ Switch between the prompt input and scrollback pane. | Key | Action | |-----|--------| -| `Ctrl+P` | Open command palette | -| `Ctrl+M` | Open model picker | -| `Ctrl+C` | Cancel current turn | -| `Ctrl+N` | Create new session (double-press to confirm) | -| `Ctrl+Q` | Quit the application | +| `Ctrl+K` (`Ctrl+P`) | Open command palette | +| `Ctrl+N` | Switch to the next model | +| `Ctrl+L` | Cycle autonomy tier | +| `Ctrl+R` | Search prompt history | +| `Ctrl+S` | Open the session picker | +| `Ctrl+A` | Toggle the HUD | +| `Ctrl+C` | Cancel the current turn (press twice quickly to quit) | --- @@ -129,7 +124,7 @@ Focus prompt: Tab or Space ``` Send: Enter -Newline: Shift+Enter or Alt+Enter +Newline: Shift+Enter Paste: Ctrl+V Leave: Tab (back to scrollback) Cancel (running): Ctrl+C @@ -140,7 +135,7 @@ Clear (idle): Esc (non-empty prompt) ## Command Palette -Press `Ctrl+P` or `?` to open the command palette — a searchable list of actions including all keyboard shortcuts, slash commands, and skills. +Press `Ctrl+K` (or `Ctrl+P`) or `?` to open the command palette — a searchable list of actions including all keyboard shortcuts, slash commands, and skills. --- diff --git a/docs/user-guide/04-slash-commands.md b/docs/user-guide/04-slash-commands.md index 63c6a2049..e243a476a 100644 --- a/docs/user-guide/04-slash-commands.md +++ b/docs/user-guide/04-slash-commands.md @@ -39,14 +39,16 @@ Show context window usage and session stats. /context ``` -### `/session-info` +### `/status` -Show session details including model, turn count, and context usage. +Show session details including session ID, model, mode, enabled tools, and cost. ``` -/session-info +/status ``` +`/session` prints a shorter summary (ID, provider, model, message count). + ### `/fork` Branch the current session into a new agent, preserving history up to this point. @@ -87,60 +89,72 @@ Set reasoning effort on the current model. Levels: `low`, `medium`, `high`, `xhi Only works when the active model supports reasoning effort. -### `/autonomy` +### `/permission` -Control the autonomy tier. Opens an interactive picker. +Show active permissions, folder trust, and the current autonomy tier. ``` -/autonomy +/permission ``` -### `/autonomy tier ` +### `/permission tier ` -Set autonomy tier without opening the picker. +Set the autonomy tier without opening the picker. Tiers: `scout`, `builder`, +`operator`, `autonomous`, or `always-ask`. ``` -/autonomy tier scout -/autonomy tier builder -/autonomy tier operator -/autonomy tier autonomous +/permission tier scout +/permission tier builder +/permission tier operator +/permission tier autonomous ``` -### `/autonomy dry-run ` +The `supervised`, `basic`, `semi`, `full`, and `yolo` names are accepted as +aliases. Press `Ctrl+L` to cycle tiers in the TUI. + +### `/permission dry-run ` Enable or disable dry-run mode (denies all tools unconditionally). ``` -/autonomy dry-run on -/autonomy dry-run off +/permission dry-run on +/permission dry-run off ``` -### `/multiline` +### `/vim` -Toggle multiline input mode. When enabled, `Enter` inserts a newline and `Shift+Enter` sends. +Toggle Vim-style input for the current session. `Shift+Enter` inserts a newline +in both modes. ``` -/multiline +/vim ``` --- ## Memory -### `/learn` +### `/memory` -Review lessons learned across sessions. +Print the project's `AGENTS.md` instructions currently loaded into context. ``` -/learn +/memory ``` -### `/remember ` +Memory capture itself is automatic; there is no `/remember` or `/forget` +command. Say "remember ..." in a prompt to make a note explicit. See +[Memory](13-memory.md). + +### `/learn` -Save a note to memory immediately. +Run the LLM-powered skill advisor, which inspects the project and suggests +skills to install. Accepts `deep` or `update`. ``` -/remember the staging deploy uses the eu-west cluster +/learn +/learn deep +/learn update ``` --- @@ -149,7 +163,7 @@ Save a note to memory immediately. ### `/hooks` -Manage hooks — file-triggered and HTTP-based event handlers. +Show the hooks Reflect loaded for the current session. ``` /hooks @@ -157,7 +171,7 @@ Manage hooks — file-triggered and HTTP-based event handlers. ### `/plugins` -View and manage installed plugins. +List installed plugins. `/plugin` is an alias. ``` /plugins @@ -234,31 +248,29 @@ Enter plan mode (alias for `/spec`). /plan Refactor the auth module ``` -### `/todo` +### `/tasks` -Create and manage task lists. +Show the current task list, including status and task IDs. ``` -/todo +/tasks ``` --- ## Asking Questions -### `/ask ` +### `/explain ` -Ask the user a clarifying question. Model uses the `AskUserQuestion` tool internally. +Ask the model to explain a file, error, or concept in the context of the +current project. ``` -/ask What framework should I use for the frontend? +/explain how the permission service resolves a tool call ``` -With options (in-tool): - -``` -/ask What database should I use? --options postgresql mysql sqlite -``` +To ask a clarifying question, just write it in the prompt. The model can call +its question tool when it needs a decision from you. --- @@ -307,12 +319,12 @@ Check developer path readiness (setup + security). /path ``` -### `/preflight` +### `/doctor` -Quick ready-to-chat check. +Run diagnostics: build, tests, and lint. ``` -/preflight +/doctor ``` ### `/ecosystem` @@ -335,7 +347,7 @@ Open settings/configuration modal. /config ``` -Aliases: `/settings`, `/preferences` +Aliases: `/con`, `/conf` ### `/theme` @@ -399,12 +411,12 @@ Manage queued prompts. /prompt-queue remove 1 ``` -### `/vim-mode` +### `/vim` Toggle vim-style keybindings. ``` -/vim-mode +/vim ``` --- diff --git a/docs/user-guide/07-mcp-servers.md b/docs/user-guide/07-mcp-servers.md index e15a2ef73..aeb0291f1 100644 --- a/docs/user-guide/07-mcp-servers.md +++ b/docs/user-guide/07-mcp-servers.md @@ -1,94 +1,100 @@ # MCP Servers -MCP (Model Context Protocol) servers extend Reflect with external tool integrations. They let Reflect interact with any service that implements the MCP standard. +MCP (Model Context Protocol) servers extend Reflect with external tools. When +you configure a server, its tools become available to the model alongside +Reflect's built-in tools. + +See the [MCP specification](https://modelcontextprotocol.io) for protocol +details. --- -## What Are MCP Servers? +## Configuration -An MCP server is a process that exposes tools to Reflect over a standardized protocol. When you configure an MCP server, its tools become available to the model alongside Reflect's built-in tools. The model can discover and call these tools during a session. +MCP servers are configured under the `mcp_servers` key in `settings.json`: -For example, a GitHub MCP server might expose tools like `create_issue`, `list_pull_requests`, and `search_code`. A database server might expose `query`, `list_tables`, and `describe_schema`. +- Global: `~/.reflect/settings.json` +- Project: `.reflect/settings.json` -See the [MCP specification](https://modelcontextprotocol.io) for protocol details. +`mcp_servers` is an **array** of server objects: ---- +```json +{ + "mcp_servers": [ + { + "name": "filesystem", + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"], + "type": "stdio" + } + ] +} +``` -## Configuration +### Fields -MCP servers are configured in `.reflect/settings.json` under the `mcp_servers` key. +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `name` | string | Yes | Unique server name, used in tool names | +| `command` | string | stdio only | Executable name or path | +| `args` | string[] | No | Arguments passed to the command | +| `type` | string | No | `stdio` (default), `sse`, `http`, or `websocket` | +| `url` | string | remote only | Server URL for `sse`, `http`, or `websocket` | +| `headers` | object | No | HTTP headers for remote transports | +| `client_id` | string | No | Pre-registered OAuth client id | + +There is no `enabled` or `env` field on a server entry. A stdio server inherits +Reflect's process environment, so export credentials before starting Reflect: + +```bash +export GITHUB_PERSONAL_ACCESS_TOKEN=... +reflect +``` ### stdio Transport (Local Process) -Reflect spawns a local process and communicates over stdin/stdout: +Reflect spawns the process and communicates over stdin/stdout: ```json { - "mcp_servers": { - "filesystem": { - "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"], - "enabled": true - }, - "github": { + "mcp_servers": [ + { + "name": "filesystem", "command": "npx", - "args": ["-y", "@modelcontextprotocol/server-github"], - "env": { - "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..." - } + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"] } - } + ] } ``` ### HTTP/SSE Transport (Remote Server) -For remote MCP servers accessible over HTTP: - ```json { - "mcp_servers": { - "linear": { + "mcp_servers": [ + { + "name": "linear", + "type": "http", "url": "https://mcp.linear.app/mcp", - "transport": "http" + "headers": { + "Authorization": "Bearer " + } } - } + ] } ``` ---- - -## CLI Management - -Manage MCP servers from the command line: - -```bash -# List configured MCP servers -reflect mcp list - -# Add a stdio server -reflect mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/dir - -# Add a remote HTTP server -reflect mcp add linear --transport http https://mcp.linear.app/mcp - -# Remove a server -reflect mcp remove github - -# Diagnose server configuration -reflect mcp doctor -reflect mcp doctor -``` - -Use `--scope project` to write to `.reflect/settings.json` in the current directory instead of the user config. +For remote servers that support OAuth, set `client_id` when the provider +requires a pre-registered client; otherwise Reflect attempts dynamic client +registration when the server advertises it. --- -## Project-Scoped MCP Servers +## Project-Scoped Servers -MCP servers can be configured per-project in `.reflect/settings.json`: +Put the same `mcp_servers` array in `.reflect/settings.json`: -``` +```text my-project/ .reflect/ settings.json @@ -96,52 +102,47 @@ my-project/ ... ``` -```json -// .reflect/settings.json -{ - "mcp_servers": { - "linear": { - "url": "https://mcp.linear.app/mcp", - "transport": "http" - } - } -} -``` - -When a server with the same name is defined globally and in the project, the project version takes precedence. - -**Trust Requirement:** Project-scoped MCP servers only load when the folder is trusted. See [Folder Trust](05-configuration.md#folder-trust) for details. +Project settings are merged over global settings when Reflect starts in that +directory. Project-scoped servers only load when the folder is trusted; see +[Folder Trust](05-configuration.md#folder-trust). --- ## Tool Naming -MCP tools are namespaced with the server name to avoid collisions: +MCP tools are namespaced to avoid collisions: -- Server `filesystem` with tool `read_file` → `filesystem__read_file` -- Server `github` with tool `create_issue` → `github__create_issue` +```text +mcp____ +``` ---- +For example, server `filesystem` with tool `read_file` becomes +`mcp__filesystem__read_file`. The tools appear in the normal tool list and can +be called directly by the model; there is no separate discovery command. -## Discovering and Using Tools +--- -Reflect provides built-in tools to work with MCP servers: +## Managing Reflect as an MCP Server -- **`search_tool`** — Discover available integration tools across all enabled MCP servers -- **`use_tool`** — Call an integration tool discovered via `search_tool` +Reflect can also act as an MCP server for another client: -Example usage: +```bash +# Run Reflect as an MCP server over stdio +reflect mcp serve +# Print the JSON block that registers Reflect in a client +reflect mcp config ``` -/search_tool github -/use_tool github__create_issue {"title": "Bug fix", "description": "..."} -``` + +`reflect mcp config` writes the client-side configuration block; it does not +manage the servers Reflect connects to. Edit `mcp_servers` in `settings.json` +for that. --- ## Available MCP Servers -A partial list of MCP servers you can configure: +A partial list of servers you can configure: | Server | Transport | Endpoint / Package | |--------|-----------|--------------------| @@ -153,7 +154,24 @@ A partial list of MCP servers you can configure: | PostgreSQL | stdio | `@modelcontextprotocol/server-postgres` | | SQLite | stdio | `@modelcontextprotocol/server-sqlite` | -See the [MCP Server Registry](https://github.com/modelcontextprotocol/servers) for the full list. +See the [MCP Server Registry](https://github.com/modelcontextprotocol/servers) +for the full list. + +--- + +## Troubleshooting + +**Server fails to start** + +- Verify the command is on `PATH` (`which `). +- Run the command manually to see its error output. +- Confirm the server supports the transport you configured. + +**Tools do not appear** + +- Restart Reflect after editing `settings.json`. +- Check that the server's `name`, `command`/`url`, and `type` are set. +- Look for MCP connection warnings in Reflect's stderr output. --- @@ -166,4 +184,4 @@ See the [MCP Server Registry](https://github.com/modelcontextprotocol/servers) f --- -© 2026 GrayCode AI. All rights reserved. \ No newline at end of file +© 2026 GrayCode AI. All rights reserved. diff --git a/docs/user-guide/09-plugins.md b/docs/user-guide/09-plugins.md index 6051d2259..57ee9a0cf 100644 --- a/docs/user-guide/09-plugins.md +++ b/docs/user-guide/09-plugins.md @@ -1,20 +1,25 @@ # Plugins -Plugins bundle skills, agents, hooks, MCP servers, and LSP configurations into one installable unit. They enable team sharing and marketplace distribution of automation. +Plugins bundle tools, hooks, skills, and MCP servers into one installable unit +so a team can share automation. --- ## What a Plugin Contains -A plugin is a directory that can hold: +A plugin is a directory with a `plugin.json` manifest at its root. It can also +ship convention-based component directories: -- **Skills** — in `skills/` directory -- **Agents** — in `agents/` directory -- **Hooks** — in `hooks/hooks.json` -- **MCP servers** — in `.mcp.json` -- **LSP servers** — in `.lsp.json` +```text +my-plugin/ + plugin.json # Manifest (required) + skills/ # Optional skills (each with SKILL.md) + hooks/ # Optional hook Markdown files + mcp.json # Optional MCP server specs +``` -For example, a `team-tools` plugin might include a deploy skill, a code-review agent, and pre-commit hooks. Install them together in one step. +A plugin can define tools (subprocess commands), event hooks, and MCP servers +directly in `plugin.json`, and can ship skills on disk. --- @@ -22,123 +27,168 @@ For example, a `team-tools` plugin might include a deploy skill, a code-review a Reflect discovers plugins from these locations, in priority order: -| Location | Scope | Trust Required | -|----------|-------|----------------| -| `.reflect/plugins/` | Project | Yes | -| `~/.reflect/plugins/` | User | No | -| `--plugin-dir` | Process | No | +| Location | Scope | Trust | +|----------|-------|-------| +| `REFLECT_MANAGED_PLUGINS` and `/managed/plugins` | Managed | Highest priority | +| `~/.reflect/plugins/` | User | Trusted automatically | +| `.reflect/plugins/` | Project | Folder trust required | -When two plugins share a name, the higher-priority location wins. +When two plugins share a name, the higher-priority scope wins. --- ## CLI Management -Manage plugins from the command line: +The command is `reflect plugin` (singular): ```bash # List installed plugins -reflect plugins list +reflect plugin list + +# Install from GitHub (owner/repo or URL) or a local directory +reflect plugin install owner/repo +reflect plugin install /path/to/local/plugin -# Install a plugin -reflect plugins install user/repo -reflect plugins install user/repo@v1.0 -reflect plugins install /path/to/local/plugin +# Inspect a plugin's components +reflect plugin inspect my-plugin -# Install with trust (required for project plugins) -reflect plugins install user/repo --trust +# Activate, deactivate, or reload +reflect plugin activate my-plugin +reflect plugin deactivate my-plugin +reflect plugin reload my-plugin -# Uninstall a plugin -reflect plugins uninstall my-plugin +# Show status and logs +reflect plugin status +reflect plugin logs my-plugin -# Update plugins -reflect plugins update +# Uninstall (deactivate and remove from disk) +reflect plugin uninstall my-plugin + +# Scaffold a new plugin +reflect plugin create my-plugin ``` +There is no `update`, `search`, or `--trust` flag. Project plugins become +available once the folder is trusted (`/trust` or `reflect trust add`). + +In the TUI, `/plugins` and `/plugin` list installed plugins. + --- ## Marketplace -Browse and install plugins from the community marketplace: +Marketplaces are JSON indexes you add as sources: ```bash -# Search marketplace -reflect plugins search go - -# Install from marketplace -reflect plugins install go-review --trust -``` +# Add a source +reflect plugin marketplace add team https://example.com/plugins/index.json -### Adding Marketplace Sources +# List configured sources +reflect plugin marketplace sources -Configure additional marketplaces in `~/.reflect/settings.json`: +# List plugins across sources +reflect plugin marketplace list -```json -{ - "marketplaces": [ - { - "name": "Team Plugins", - "source": { - "git": "https://github.com/my-org/plugins.git" - } - } - ] -} +# Install by marketplace name +reflect plugin marketplace install go-review ``` --- ## Trust Model -- **User plugins** (`~/.reflect/plugins/`) — Trusted automatically -- **Project plugins** (`.reflect/plugins/`) — Require explicit trust before activation +- **User plugins** (`~/.reflect/plugins/`) are trusted automatically. +- **Project plugins** (`.reflect/plugins/`) require folder trust before they + load, because plugins can execute code through tools, hooks, and MCP servers. -Trust is required because plugins can execute code via hooks and MCP servers. To trust a plugin: +--- -```bash -reflect plugins install --trust +## plugin.json Manifest + +```json +{ + "name": "my-plugin", + "version": "1.0.0", + "description": "Team development tools", + "author": "Example Team", + "license": "MIT", + "mode": "subprocess", + "tools": [ + { + "name": "hello", + "description": "Print a greeting", + "command": "./bin/hello", + "args": [], + "input_schema": { + "type": "object", + "properties": { + "message": { "type": "string" } + } + }, + "timeout_seconds": 30 + } + ], + "hooks": [ + { + "event": "post_tool", + "command": "./bin/on-post-tool", + "async": true, + "priority": 100 + } + ], + "permissions": [] +} ``` ---- +| Field | Description | +|-------|-------------| +| `name` | Required, unique plugin name | +| `version` | Plugin version | +| `mode` | `subprocess` (default) or `daemon` | +| `entrypoint` | Binary path for daemon mode | +| `tools` | Tool definitions with `name`, `description`, `command`, `args`, `input_schema`, `timeout_seconds` | +| `hooks` | `event`, `command`, `async`, `priority` | +| `dependencies` | Other plugin names required | +| `components` | Optional overrides for `skills_dir`, `hooks_dir`, `mcp_file`, inline `mcp` | -## Plugin Directory Layout +Hook `event` values use the same names as [Hooks](10-hooks.md), for example +`pre_tool`, `post_tool`, `session_start`. -``` -my-plugin/ - skills/ - SKILL.md - agents/ - reviewer.yaml - deployer.yaml - hooks/ - hooks.json - plugin.json # Optional manifest -``` +### Component Overrides -### plugin.json Manifest +If you do not use the conventional layout, point at your directories: ```json { "name": "my-plugin", "version": "1.0.0", - "description": "Team development tools", + "description": "Custom layout", "components": { - "skills": true, - "agents": true, - "hooks": true + "skills_dir": "capabilities/skills", + "hooks_dir": "automation/hooks", + "mcp_file": "config/mcp.json" } } ``` --- +## Security + +Plugins execute code. Only install plugins you trust, and review `plugin.json` +and any referenced scripts before activating a project plugin. Reflect's plugin +scanner flags common risky patterns, but it is not a sandbox. + +--- + ## Where to Go Next | Document | What You Will Learn | |----------|-------------------| | [Hooks](10-hooks.md) | Event-driven automation | -| [Custom Models](11-custom-models.md) | Provider configuration | +| [MCP Servers](07-mcp-servers.md) | External tool servers | +| [Skills](08-skills.md) | Installing and using skills | --- -© 2026 GrayCode AI. All rights reserved. \ No newline at end of file +© 2026 GrayCode AI. All rights reserved. diff --git a/docs/user-guide/10-hooks.md b/docs/user-guide/10-hooks.md index df143d88d..ebe5601d8 100644 --- a/docs/user-guide/10-hooks.md +++ b/docs/user-guide/10-hooks.md @@ -1,181 +1,162 @@ # Hooks -Hooks let you run code at key moments in a Reflect session. Use them to automate tasks, enforce safety checks, log activity, and integrate custom tools. +Hooks run a command when a Reflect lifecycle event occurs. Use them to log +activity, run formatters or linters, or trigger an external integration. --- -## What Are Hooks? +## What Hooks Can Do -A hook is a shell command or HTTP endpoint that Reflect calls when a specific lifecycle event occurs. Hooks can: +A hook is a command attached to an event. Reflect runs the command and +continues; hook output goes to Reflect's stdout/stderr, and a failing hook is +logged without stopping the session. -- **Block actions** — A `PreToolUse` hook can deny a dangerous command before it runs -- **React to events** — A `PostToolUse` hook can log every tool execution -- **Set up context** — A `SessionStart` hook can run setup scripts +Hooks are **observers with side effects**. They do not approve or deny tool +calls — use permission rules for that (see [Permissions](06-permissions.md)). --- ## Hook Events -| Event | When It Fires | Blocking | -|-------|---------------|----------| -| `SessionStart` | Session starts | No | -| `UserPromptSubmit` | You submit a prompt | No | -| `PreToolUse` | Tool is about to run | Yes (can deny) | -| `PostToolUse` | Tool completes | No | -| `PostToolUseFailure` | Tool fails | No | -| `PermissionDenied` | Permission denied | No | -| `Stop` | Agent turn ends | No | -| `Notification` | Agent sends notification | No | -| `SubagentStart` | Subagent starts | No | -| `SubagentStop` | Subagent finishes | No | -| `SessionEnd` | Session ends | No | - -Only `PreToolUse` can block a tool call. All other events are passive. +| Event | When it fires | +|-------|---------------| +| `session_start` | A session starts | +| `user_prompt_submit` | You submit a prompt | +| `user_prompt_queued` | A prompt is queued while the agent is busy | +| `turn_started` | An agent turn begins | +| `pre_query` | A model query is about to run | +| `post_query` | A model query completes | +| `pre_tool` | A tool is about to run | +| `post_tool` | A tool completed | +| `post_tool_failure` | A tool failed | +| `pre_compact` / `post_compact` | Around context compaction | +| `file_changed` | A file changed (`pattern` is matched against the path) | +| `permission_ask` / `permission_result` | A permission prompt is raised / answered | +| `subagent_start` / `subagent_stop` | A subagent starts or finishes | +| `task_started` | A background task starts | +| `session_heartbeat` | A periodic session liveness event | +| `stop` / `stop_failure` | A turn stops, or stopping fails | +| `failure` | The run fails | +| `interrupt` | The user interrupts a turn | +| `notification` | Reflect emits a notification | +| `test_result` | A test run reports a result | + +Vendor spellings such as `PreToolUse`, `PostToolUse`, and `post_tool_use` are +accepted and normalized to the same events. --- -## Hook Configuration - -Create hooks in `.reflect/hooks/hooks.json`: - -```json -{ - "hooks": { - "PreToolUse": [ - { - "matcher": "Bash", - "hooks": [ - { "type": "command", "command": "bin/safety-check.sh" } - ] - } - ], - "SessionStart": [ - { - "hooks": [ - { "type": "command", "command": "echo 'Session started'" } - ] - } - ] - } -} -``` +## Hook Files -### Key Fields +Create one Markdown file per hook under `.reflect/hooks/`: -- **matcher** (optional): Regex matching the tool name -- **type**: `"command"` (shell script) or `"http"` (HTTP endpoint) -- **command**: Script path or inline command -- **timeout**: Seconds before killing the hook +```text +.reflect/hooks/log-edits.md +``` +```markdown +--- +name: log-edits +event: PostToolUse +command: ./scripts/log-tool.sh +timeout: 10 +async: true --- -## PreToolUse Hooks +Optional notes about this hook. Reflect reads the YAML frontmatter. +``` -PreToolUse hooks receive JSON on stdin and must output a decision: +### Frontmatter fields -```json -{ - "hookEventName": "PreToolUse", - "sessionId": "abc-123", - "toolName": "Bash", - "toolInput": { "command": "rm -rf /" } -} -``` +| Field | Required | Description | +|-------|----------|-------------| +| `name` | No | Hook name; defaults to the file name | +| `event` | Yes | One of the events above | +| `command` | Yes | Command to execute | +| `pattern` | No | Glob matched against a `path` payload field | +| `timeout` | No | Seconds before the command is killed (default `30`) | +| `async` | No | Run in the background instead of waiting | -### Output Format +The command is split into arguments and executed directly, **not through a +shell**. Pipes, redirection, and `&&` therefore need a script: -**Allow:** -```json -{"decision": "allow"} +```markdown +--- +name: format-go +event: PostToolUse +pattern: "*.go" +command: ./scripts/gofmt-changed.sh +--- ``` -**Deny:** -```json -{"decision": "deny", "reason": "Unsafe command blocked"} -``` +`${NAME}` placeholders in `command` are replaced with matching event payload +fields, then with environment variables. For anything more complex, read the +environment inside the script. -Exit code `2` also signals denial. Any other exit code is fail-open (tool is allowed). +Project hooks inherit the environment of the Reflect process, so export any +secret or token before starting Reflect rather than putting it in the hook file. --- -## Trust Model +## Hook Locations -- **User hooks** (`~/.reflect/hooks/`) — Always trusted -- **Project hooks** (`.reflect/hooks/`) — Require folder trust +Reflect loads hooks from these directories, in order: -Project hooks are blocked until you trust the folder: +| Scope | Location | Trust | +|-------|----------|-------| +| Project | `.reflect/hooks/` | Folder trust required | +| Project (compatibility) | `.agents/hooks/`, `.claude/hooks/` | Folder trust required | +| User | Reflect state `hooks/` directory | Always trusted | +| User | Reflect config `hooks/` directory | Always trusted | -``` -/trust # Trust the current folder -/trust status # Check trust status +Project hooks stay disabled until you trust the folder. In the TUI: + +```text +/trust ``` --- -## Environment Variables +## Inspecting Hooks -Reflect sets these variables for every hook: +Show the hooks Reflect loaded for the current session: -| Variable | Description | -|----------|-------------| -| `REFLECT_HOOK_EVENT` | Event name (e.g., `PreToolUse`) | -| `REFLECT_SESSION_ID` | Current session ID | -| `REFLECT_WORKSPACE_ROOT` | Project root path | -| `REFLECT_PLUGIN_ROOT` | Plugin directory (for plugin hooks) | -| `REFLECT_PLUGIN_DATA` | Plugin data directory | - ---- +```text +/hooks +``` -## CLI Management +If a hook file has invalid frontmatter, Reflect prints a warning and skips that +file. Check the warning text for the file path and parse error. -```bash -# List hooks -reflect hooks list +--- -# Trust project hooks -reflect hooks trust +## Example: Log Every Bash Command -# Untrust project hooks -reflect hooks untrust -``` +`.reflect/hooks/log-bash.md`: +```markdown +--- +name: log-bash +event: PreToolUse +command: /absolute/path/to/scripts/log-bash.sh +async: true --- - -## Example: Safe Shell Guard - -Create `.reflect/hooks/safety.json`: - -```json -{ - "hooks": { - "PreToolUse": [ - { - "matcher": "Bash", - "hooks": [ - { "type": "command", "command": "bin/safe-shell.sh", "timeout": 5 } - ] - } - ] - } -} ``` -Create `bin/safe-shell.sh`: +`scripts/log-bash.sh`: ```bash -#!/bin/bash -INPUT=$(cat) -CMD=$(echo "$INPUT" | jq -r '.toolInput.command // empty') +#!/usr/bin/env bash +set -euo pipefail -# Block destructive patterns -if echo "$CMD" | grep -qE '(rm -rf /|mkfs|dd if=)'; then - echo '{"decision": "deny", "reason": "Blocked destructive command"}' - exit 2 -fi - -echo '{"decision": "allow"}' +printf '%s PreToolUse hook fired\n' "$(date -u +%FT%TZ)" \ + >> "${HOME}/.reflect/bash-audit.log" ``` +Use an absolute path (or a path relative to the working directory Reflect was +started in) so the hook resolves consistently. Hooks do not receive a stable +per-event environment contract, so keep them self-contained. + --- ## Where to Go Next @@ -184,7 +165,8 @@ echo '{"decision": "allow"}' |----------|-------------------| | [Custom Models](11-custom-models.md) | Provider configuration | | [Project Rules](12-project-rules.md) | AGENTS.md configuration | +| [Plugins](09-plugins.md) | Packaging hooks with a plugin | --- -© 2026 GrayCode AI. All rights reserved. \ No newline at end of file +© 2026 GrayCode AI. All rights reserved. diff --git a/docs/user-guide/13-memory.md b/docs/user-guide/13-memory.md index e5d594fcd..9fa22040b 100644 --- a/docs/user-guide/13-memory.md +++ b/docs/user-guide/13-memory.md @@ -1,115 +1,79 @@ # Memory -Memory lets Reflect recall facts, decisions, and patterns from earlier sessions. Reflect indexes saved information and searches it automatically, so new sessions can reuse relevant context. +Memory lets Reflect recall facts, decisions, and corrections from earlier +sessions. Reflect stores memories locally and searches them automatically, so a +new session can reuse relevant context without you repeating yourself. --- -## What Is Memory? +## What Memory Is -Without memory, each Reflect session starts fresh. When memory is enabled, Reflect can: +Without memory, each session starts fresh. With memory, Reflect can carry +forward: -- Recall project conventions you explained before -- Reuse debugging steps that worked -- Carry architectural decisions forward across sessions -- Avoid re-asking questions it already has answers to +- Project conventions you explained before +- Debugging steps that worked +- Architectural decisions +- Corrections you made to the agent's behaviour -Memory is a local subsystem built into Reflect. It stores memories as files under -Reflect's state directory; no external service is required. +Memory is a local subsystem built into Reflect. It stores files under Reflect's +state directory; no external service is required. --- -## Enabling Memory +## How Memory Is Captured -Memory is on by default. To inspect what has been stored: +Memory capture is automatic. Reflect looks for signals in the conversation — +explicit requests such as "remember this", corrections such as "don't do X", +and durable statements such as "convention: ..." or "always use ...". It also +writes a short session-goal memory when a session ends. -``` -/learn # lessons learned across sessions -``` +You do not need to enable memory or run a command to save a fact. To make a +memory explicit, say so in the prompt: -### Settings - -```json -// ~/.reflect/settings.json -{ - "memory": { - "enabled": true - } -} +```text +Remember that this repo formats Go with gofumpt, not gofmt. ``` +Reflect also consolidates and prunes memories in the background so the set stays +useful. + --- ## How Memory Is Stored -Memory is stored under Reflect's state directory (`~/.reflect/` by default). +| Location | Scope | Contents | +|----------|-------|----------| +| `~/.reflect/memories/` | Global | JSON memory records | +| Reflect project state (`memory/` under the project's state directory) | Project | Topic-based Markdown notes | -| Location | Scope | Description | -|----------|-------|-------------| -| `~/.reflect/memories/` | Global | Core memories and preferences | -| `~/.reflect/` state files | Workspace | Project-specific memory and lessons | - -Reflect combines core memories, automatic captures, evolving guidelines, and -retrieval metrics to rank what is relevant to the current turn. +Memory files are plain text and JSON. You can read them directly, back them up, +or delete a file to forget that item. There is no destructive "forget" +command; removing the file is the supported way to delete a memory. --- -## Working with Memory - -### Remember - -Ask Reflect to remember something: - -``` -/remember always open PR links after pushing -``` - -Reflect records entries as durable statements organized by topic. - -### Forget - -Ask what Reflect should forget: - -``` -/forget the snake_case convention -``` - -Forget is best-effort. - -### Recall +## How Memory Is Recalled -Ask what Reflect remembers: - -``` -/what do you remember about auth? -``` +On each turn, Reflect searches core memories, project notes, evolving +guidelines, and related stores, then injects the most relevant results into the +model context within a token budget. Recall is automatic — you do not invoke it. -Reflect searches across all memory sources and summarizes. +When memory is used, the injected block appears as `## Relevant Memories`. --- -## Browsing Memory +## Inspecting Memory -Lessons learned are surfaced through: +There is no dedicated memory browser command. Use the filesystem: +```bash +ls ~/.reflect/memories/ +cat ~/.reflect/memories/.json ``` -/learn -``` - ---- - -## First-Turn Injection -On the first turn of each session, Reflect automatically searches memory for content relevant to the current project and injects it as context. - -Configure injection: - -```json -{ - "memory": { - "first_turn_injection": true - } -} -``` +`/memory` is unrelated to this store: it prints the project's `AGENTS.md` +instructions. See [Project Rules](12-project-rules.md) for that file. --- @@ -117,9 +81,10 @@ Configure injection: | Document | What You Will Learn | |----------|-------------------| +| [Project Rules](12-project-rules.md) | `AGENTS.md` project instructions | +| [Sessions](17-sessions.md) | Conversation persistence | | [Headless Mode](14-headless-mode.md) | Non-interactive usage | -| [Agent Mode](15-agent-mode.md) | Agent configuration | --- -© 2026 GrayCode AI. All rights reserved. \ No newline at end of file +© 2026 GrayCode AI. All rights reserved. diff --git a/docs/user-guide/15-agent-mode.md b/docs/user-guide/15-agent-mode.md index c88667fc4..5ccf41c72 100644 --- a/docs/user-guide/15-agent-mode.md +++ b/docs/user-guide/15-agent-mode.md @@ -1,17 +1,19 @@ # Agent Mode (ACP) and IDE Integration -Agent mode runs Reflect as an ACP (Agent Client Protocol) server for IDE integration and custom tooling. +Reflect can run as an Agent Client Protocol (ACP) server so editors and other +clients can drive a Reflect session over stdio. --- -## What is ACP? +## What Is ACP? -The [Agent Client Protocol (ACP)](https://agentclientprotocol.com) is a standard for AI agent communication. It enables: +The [Agent Client Protocol (ACP)](https://agentclientprotocol.com) is a standard +for communication between an AI agent and a client such as an IDE. It provides: - **Session management** — create, load, and resume conversations - **Prompt submission** — send messages and receive streamed responses - **Tool visibility** — see tool usage in real time -- **Permission handling** — approve/deny tool executions +- **Permission handling** — approve or deny tool executions through the client --- @@ -20,114 +22,74 @@ The [Agent Client Protocol (ACP)](https://agentclientprotocol.com) is a standard Run Reflect as an ACP server over stdio: ```bash -reflect agent stdio +reflect acp ``` +stdout is the JSON-RPC channel; logs are kept off stdout. The client starts the +process and speaks ACP over stdin/stdout. + Clients include: + - IDE extensions (Zed, Neovim, Emacs) - Custom automation tools - ACP client libraries -### Options - -```bash -reflect agent --model gpt-4o stdio -reflect agent --auto stdio -reflect agent --agent-profile path/to/profile.yaml stdio -``` - -| Flag | Description | -|------|-------------| -| `-m, --model` | Set the model ID | -| `--auto` | Auto-approve tool executions | -| `--agent-profile` | Load agent profile from file | - ---- +The model, provider, permissions, and hooks come from your normal Reflect +configuration. Select them before starting the server, for example with +`reflect config`, `reflect models`, or the corresponding settings file. -## Running the Agent Server +### Example: Zed -### WebSocket Server +Register Reflect as an agent server in Zed's settings: -```bash -reflect agent serve --bind 127.0.0.1:2419 --secret +```json +{ + "agent_servers": { + "reflect": { + "command": "/absolute/path/to/reflect", + "args": ["acp"] + } + } +} ``` -Connect clients over WebSocket using the secret token for authentication. +Use an absolute path so the editor can find the binary even when it does not +inherit your shell `PATH`. --- -## Session Lifecycle +## Agent Personas -1. **Initialize** — client sends `initialize` with capabilities -2. **Create session** — client sends `session/new` with working directory -3. **Send prompts** — client sends `session/prompt` -4. **Receive updates** — agent streams `session/update` events -5. **Handle permissions** — approve/deny as needed +Agent personas are separate from the ACP server. Manage them with: ---- - -## Streaming Updates - -ACP streams structured events with `sessionUpdate` types: +```bash +reflect agent list +reflect agent create reviewer --description "Reviews diffs" +reflect agent show reviewer +reflect agent remove reviewer +``` -| Type | Description | -|------|-------------| -| `agent_message_chunk` | Response text | -| `agent_thought_chunk` | Reasoning tokens | -| `tool_call` | Tool invocation started | -| `tool_call_update` | Tool status/result | +A persona created this way can be selected for a normal session or referenced +from your workflow. --- -## Extension Methods - -Reflect provides `x.ai/*` extension methods: +## Permissions -| Category | Methods | -|----------|---------| -| Filesystem | `x.ai/fs/*` (read, write, list) | -| Git | `x.ai/git/*` (status, commit, diff) | -| Worktree | `x.ai/git/worktree/*` | -| Search | `x.ai/search/*` | -| Terminal | `x.ai/terminal/*` | +ACP routes tool-permission prompts back to the client through +`session/request_permission`. The client decides whether a tool call is allowed, +so an IDE can present its own approval UI. --- -## Compatible Clients +## Troubleshooting -| Client | Status | -|--------|--------| -| Zed | Supported | -| Neovim | Supported (via CodeCompanion, avante.nvim) | -| Emacs | Supported | -| JetBrains | Planned | - ---- - -## Integration Example - -```typescript -import { spawn } from "child_process"; - -// Start ACP server -const proc = spawn("reflect", ["agent", "stdio"]); - -// Initialize -proc.stdin.write(JSON.stringify({ - jsonrpc: "2.0", - id: 1, - method: "initialize", - params: { protocolVersion: 1, clientCapabilities: { terminal: true } } -}) + "\n"); - -// Create session -proc.stdin.write(JSON.stringify({ - jsonrpc: "2.0", - id: 1, - method: "session/new", - params: { cwd: "." } -}) + "\n"); -``` +- **No output / client disconnects** — make sure nothing else is writing to + stdout. Diagnostics and logs belong on stderr. +- **Command not found** — use the absolute path to the `reflect` binary in the + client configuration. +- **Provider errors** — run `reflect doctor` in the same environment to check + credentials and model configuration. --- @@ -135,9 +97,10 @@ proc.stdin.write(JSON.stringify({ | Document | What You Will Learn | |----------|-------------------| -| [Subagents](16-subagents.md) | Parallel agent sessions | -| [Sessions](17-sessions.md) | Session management | +| [Headless Mode](14-headless-mode.md) | Non-interactive `reflect -p` and `reflect exec` | +| [Hooks](10-hooks.md) | Lifecycle commands | +| [MCP Servers](07-mcp-servers.md) | External tool servers | --- -© 2026 GrayCode AI. All rights reserved. \ No newline at end of file +© 2026 GrayCode AI. All rights reserved. diff --git a/docs/user-guide/17-sessions.md b/docs/user-guide/17-sessions.md index 97104377d..0b23fb9f8 100644 --- a/docs/user-guide/17-sessions.md +++ b/docs/user-guide/17-sessions.md @@ -109,10 +109,11 @@ Auto-compact triggers when context window approaches limit. View session details: ``` -/session-info +/status ``` -Shows model, working directory, context usage, and session ID. +Shows the session ID, model, mode, enabled tools, and cost. `/session` prints a +compact session summary (ID, provider, model, message count). --- diff --git a/docs/user-guide/23-dashboard.md b/docs/user-guide/23-dashboard.md index bc2a7b71b..d356433fb 100644 --- a/docs/user-guide/23-dashboard.md +++ b/docs/user-guide/23-dashboard.md @@ -1,60 +1,64 @@ # Dashboard and HUD -The Reflect dashboard provides system status and monitoring information. +The Reflect TUI exposes system status through a few slash commands and CLI +subcommands. --- -## Opening the Dashboard +## Opening Status Views In the TUI: -``` +```text /ecosystem # Ecosystem status (Relay and token pipeline) /path # Developer path readiness -/preflight # Quick health check +/doctor # Run diagnostics: build, tests, lint +/status # Session id, model, mode, tools, cost +``` + +From the shell: + +```bash +reflect path # Developer path readiness +reflect doctor # Full health report ``` --- ## Ecosystem Status -Shows the status of all Reflect components: +`/ecosystem` shows the status of the components Reflect depends on: -| Component | Status | -|-----------|--------| -| Relay (providers) | Ready / Error | -| token pipeline | Available | -| memory | Ready | +| Component | Meaning | +|-----------|---------| +| Relay (providers) | Provider runtime ready / error | +| Token pipeline | Context and token accounting available | +| Memory | Local memory subsystem ready | --- ## Developer Path -Check readiness to chat: +`reflect path` (or `/path`) verifies readiness to chat: -```bash -reflect path -``` - -This verifies: - Configuration setup - Credential status - Security readiness +`reflect doctor` runs deeper checks and reports build, test, and lint health. + --- ## Usage Display View credit usage and cost: -``` +```text /usage ``` -Shows: -- Token consumption -- Estimated costs -- Model breakdown +`/usage` is an alias for `/cost`. It shows token consumption, estimated cost, +and a per-model breakdown for the current session. --- @@ -62,8 +66,8 @@ Shows: | Document | What You Will Learn | |----------|-------------------| -| [Monitoring Usage](24-monitoring-usage.md) | Telemetry details | +| [Monitoring Usage](24-monitoring-usage.md) | Telemetry and usage details | --- -© 2026 GrayCode AI. All rights reserved. \ No newline at end of file +© 2026 GrayCode AI. All rights reserved. diff --git a/docs/user-guide/24-monitoring-usage.md b/docs/user-guide/24-monitoring-usage.md index dd9a1311a..592d14c1f 100644 --- a/docs/user-guide/24-monitoring-usage.md +++ b/docs/user-guide/24-monitoring-usage.md @@ -1,6 +1,7 @@ # Monitoring and Usage -Reflect tracks token usage, costs, and session activity for monitoring and debugging. +Reflect tracks token usage, costs, and session activity for monitoring and +debugging. --- @@ -10,81 +11,82 @@ Token usage is tracked per session and aggregated. ### View Usage +```text +/usage # alias for /cost +/cost +``` + +From the shell: + ```bash -reflect usage -reflect doctor # Full health report +reflect stats +reflect doctor # full health report ``` Usage shows: + - Input/output tokens per model - Total cost estimate - Session count --- -## Telemetry +## Telemetry (Opt-In) -Reflect can send anonymous usage telemetry. +Reflect does **not** send telemetry by default. OpenTelemetry export is opt-in +and goes to the OTLP endpoint you configure — there is no GrayCode-operated +telemetry collector and no CLI flag to toggle it. -### Enable/Disable +### Enable -```json -// ~/.reflect/settings.json -{ - "telemetry": { - "enabled": false - } -} +```bash +export REFLECT_ENABLE_TELEMETRY=1 +export OTEL_EXPORTER_OTLP_ENDPOINT=https://collector.example.com:4318 +export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer " # optional +reflect ``` -Or: +`OTEL_EXPORTER_OTLP_ENDPOINT` alone does not enable export; both the +`REFLECT_ENABLE_TELEMETRY=1` opt-in and an endpoint are required. + +### Disable + +Unset the variable, or set it to anything other than `1`: ```bash -reflect --telemetry # Enable -haw --no-telemetry # Disable +unset REFLECT_ENABLE_TELEMETRY ``` ---- - -## OpenTelemetry Export +### Log Export -Export usage to your own OTEL collector: +Log export additionally requires an OTLP logs endpoint: -```json -{ - "telemetry": { - "otel_enabled": true, - "otel_endpoint": "https://collector.example.com:4318" - } -} +```bash +export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://collector.example.com:4318 ``` -Set `OTEL_EXPORTER_OTLP_HEADERS` for authentication. - --- ## Session Metrics Per-session metrics include: + - Turn count - Tool call count - Token totals - Duration -Accessible via `/ecosystem` in TUI. +Use `/status` for the current session summary and `/cost` for token and cost +detail. `/metrics` prints the collected metrics for the session. --- -## Cloud Integration - -Reflect Cloud provides managed usage tracking: - -- Organization-level metrics -- Budget alerts -- Entitlement management +## Hosted Control Plane -See graycode-cloud documentation for details. +An optional hosted control plane (GrayCode Cloud) can aggregate organization +usage and budgets when you connect Reflect to it. Local usage tracking works +without it. See [Authentication](02-authentication.md) for connection details. --- -© 2026 GrayCode AI. All rights reserved. \ No newline at end of file +© 2026 GrayCode AI. All rights reserved. diff --git a/examples/github/reflect-issue-resolver.yml b/examples/github/reflect-issue-resolver.yml index e953177be..91cfa32c9 100644 --- a/examples/github/reflect-issue-resolver.yml +++ b/examples/github/reflect-issue-resolver.yml @@ -41,11 +41,12 @@ jobs: - name: Run Reflect id: reflect - uses: GrayCodeAI/reflect/.github/actions/reflect@main + uses: GrayCodeAI/reflect/.github/actions/reflect@v1.0.0 with: - # Leave prompt empty so Reflect derives it from the triggering event. - # Set a "/skill-name args" prompt here to dispatch a skill instead. - prompt: "" + # The action requires a prompt. On an issue label event Reflect + # replaces this with the issue title and body; on a comment event it + # replaces it with the comment text after "@reflect". + prompt: "Resolve the GitHub issue described in this event." auto: semi output-format: text env: @@ -53,11 +54,16 @@ jobs: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - name: Post Reflect response as a comment - if: ${{ steps.reflect.outputs.response != '' }} + if: ${{ always() && steps.reflect.outputs.output-file != '' }} uses: actions/github-script@v7 + env: + REFLECT_OUTPUT_FILE: ${{ steps.reflect.outputs.output-file }} with: script: | - const body = `🦅 **Reflect**\n\n${{ toJSON(steps.reflect.outputs.response) }}`; + const fs = require('fs'); + const output = fs.readFileSync(process.env.REFLECT_OUTPUT_FILE, 'utf8').trim(); + if (!output) return; + const body = `🦅 **Reflect**\n\n${output}`; const issueNumber = context.issue.number; if (issueNumber) { await github.rest.issues.createComment({ From dc864660e97dc8d838ab5ddee5ee28451edb81b2 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Wed, 2 Dec 2026 19:38:46 +0530 Subject: [PATCH 2/5] docs: remove stale ecosystem and registry references --- AGENTS.md | 7 ++-- README.md | 47 +++++++++---------------- docs/README.md | 7 ++-- docs/compatibility.md | 11 +++--- docs/user-guide/02-authentication.md | 2 +- docs/user-guide/04-slash-commands.md | 13 +++---- docs/user-guide/08-skills.md | 52 ++++++++++++++++------------ examples/README.md | 43 ++++++++++++----------- llms.txt | 14 ++++---- 9 files changed, 95 insertions(+), 101 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 57416aaec..7f4612349 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -119,13 +119,12 @@ Installed skills live in user or project scope: there is no published index at this time, so treat those subcommands as unavailable and install directly from a repository you trust. -A skill manifest: +A `SKILL.md` manifest: ```markdown --- -description: How to review Go code for security issues -globs: "*.go" -alwaysApply: true +name: go-security-review +description: Reviews Go code for SQL injection, unsafe error handling, hardcoded secrets, and input-validation gaps. --- When reviewing Go code for security: diff --git a/README.md b/README.md index b51bc96d5..24b718ec2 100644 --- a/README.md +++ b/README.md @@ -241,14 +241,17 @@ Each sub-agent runs in its own git worktree with full autonomy. ### Community Skills -Discover and install modular instruction packages for specialized workflows: +Install modular instruction packages for specialized workflows: ```bash -reflect skills search api # Search community registry -reflect skills install go-review # Install from GitHub -reflect skills audit # Security scan installed skills +reflect skills install owner/repo # install from a public GitHub repository +reflect skills list # list installed skills +reflect skills audit # security scan installed skills ``` +`reflect skills search` and `reflect skills trending` depend on a community +index that is not published yet, so they currently return no results. + ### Plan, Build, Review The CLI uses its original full-width chat layout, with the input fixed at the @@ -494,22 +497,19 @@ reflect/ ├── docs/ # Architecture, security, integration docs └── testdata/ # Test fixtures -Ecosystem sibling repos (independent Git repos in the `graycode-eco` parent -folder): +Sibling repository (a separate Git repo, checked out alongside this one only for +coordinated development): ├── relay/ # LLM provider runtime ``` ### Ecosystem -reflect is the main CLI/product and integrates these GrayCodeAI repositories in -three runtime layers plus optional tooling/platform services: +reflect is the end-user product. It has one runtime dependency: + +- **relay** — the LLM provider runtime, consumed through its stable engine facade. -- **Primary product:** **reflect** is the only end-user product surface in this ecosystem. -- **Provider engine mounted by Reflect:** **relay** is the LLM provider runtime, consumed through its stable engine facade. -- **API consumers/extensions:** **graycode-skills** provides Reflect skills - installed on demand (`reflect skills install`). -- **Tooling/platform:** **graycode-platform** contains the optional web/BFF/Reflect - Cloud plane and is outside the Reflect Go runtime graph. +An optional hosted control plane (GrayCode Cloud) is operated separately from +this repository and is not required to build, test, or run reflect. Reflect builds and tests independently against the published Relay version in `go.mod`. Setup and CI require only this repository. @@ -520,8 +520,8 @@ to create a gitignored `go.local.mod` with an explicit local replacement, then r Verify the normal published dependency graph separately with `make ci`. Cross-repo contracts now live in `internal/contracts` (vendored from the -removed `github.com/GrayCodeAI/eagle` module) so support repos do not depend -on Reflect internals. External consumers should vendor the needed DTOs from `internal/contracts` +removed `github.com/GrayCodeAI/eagle` module) so external consumers do not depend +on Reflect internals. They should vendor the needed DTOs from `internal/contracts` until a published contracts module exists. Current contract packages (`internal/contracts/`): @@ -541,21 +541,8 @@ Reflect does not create or modify parent workspaces. |---|---|---| | **reflect** | This repo | AI coding agent | | **relay** | [GrayCodeAI/relay](https://github.com/GrayCodeAI/relay) | LLM provider runtime | -| **graycode-skills** | [GrayCodeAI/graycode-skills](https://github.com/GrayCodeAI/graycode-skills) | Community skill registry | -| **graycode-platform** | [GrayCodeAI/graycode-platform](https://github.com/GrayCodeAI/graycode-platform) | Web, BFF, and Reflect Cloud | - -The canonical inventory of sibling repositories is -[`GrayCodeAI/graycode-eco/ecosystem.yaml`](https://github.com/GrayCodeAI/graycode-eco/blob/main/ecosystem.yaml), -not the `ecosystem.yaml` in this repo, which is deprecated and incomplete. The -inventory moved because a product must not own the registry of its siblings: it -lived here, `reflect` was renamed from `hawk` without signalling the other nine -repositories, and the list silently omitted `beam`. See -[graycode-eco/adr/0001](https://github.com/GrayCodeAI/graycode-eco/blob/main/adr/README.md). - -`scripts/ecosystem-manifest.sh` reads the roof's file and falls back to the -deprecated local copy only when the roof is not checked out alongside. -`relay` is the only Go module dependency in the entire ecosystem; it is consumed +`relay` is the only Go module dependency in the project; it is consumed through its stable engine facade. For the consolidated repo map and the current-vs-proposed architecture diagrams, see [docs/architecture/reflect-current-vs-proposed.md](docs/architecture/reflect-current-vs-proposed.md). diff --git a/docs/README.md b/docs/README.md index 8edb0cb09..37ddf8170 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,9 +1,8 @@ # Reflect Documentation -Index for `reflect/docs/`. The canonical repo inventory is -[`GrayCodeAI/graycode-eco/ecosystem.yaml`](https://github.com/GrayCodeAI/graycode-eco/blob/main/ecosystem.yaml) -— the `ecosystem.yaml` in this repo is deprecated and incomplete, and -`ECOSYSTEM-WIRING.md` is historical. +Index for `reflect/docs/`. Reflect is an end-user product with one runtime +sibling, [Relay](https://github.com/GrayCodeAI/relay); the historical +`ecosystem.yaml` in this repo and `ECOSYSTEM-WIRING.md` are archival only. - **Architecture** `architecture/README.md` + `architecture.md` - **User Guide** `user-guide/` (skills, slash commands, permissions) diff --git a/docs/compatibility.md b/docs/compatibility.md index 222452e9b..47c6e9a70 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -15,17 +15,18 @@ Platform/provider capability metadata is separate: [`platform-capabilities.json` "components": ["reflect", "relay", ...], // canonical eco roster "dependencies": { "reflect": ["relay", ...] }, // who depends on who "matrices": [ - { "name": "stable", "components": { "reflect": "0.1.0", "relay": "0.1.0", ... } }, - { "name": "next", "components": { "reflect": "main", "relay": "main", ... } } + { "name": "stable", "components": { "reflect": "1.0.0", "relay": "1.0.0" } }, + { "name": "next", "components": { "reflect": "main", "relay": "main" } } ] } ``` Supported matrix names: -- **`stable`** — the most recent combination of released versions tested - end-to-end: `reflect` 1.0.0 with the Relay version pinned in `go.mod` - (`relay` 1.0.0). +- **`stable`** — reserved for the most recent combination of released versions + tested end-to-end. The current file records only `next`; add `stable` after a + coordinated release is verified (`reflect` 1.0.0 with `relay` 1.0.0 is the + first candidate). - **`next`** — the bleeding edge: the latest commit on each repo's `main` branch. CI runs the integration tests against this matrix on every PR to any eco repo. diff --git a/docs/user-guide/02-authentication.md b/docs/user-guide/02-authentication.md index 69397e2ef..0ee2ec9a7 100644 --- a/docs/user-guide/02-authentication.md +++ b/docs/user-guide/02-authentication.md @@ -133,7 +133,7 @@ eyJhbGciOiJSUzI1NiIs... JSON with optional refresh token: ```json -{"access_token": "eyJhbGciOi...", "refresh_token": "ref-shrike", "expires_in": 3600} +{"access_token": "eyJhbGciOi...", "refresh_token": "ref-refresh", "expires_in": 3600} ``` ### Configuration diff --git a/docs/user-guide/04-slash-commands.md b/docs/user-guide/04-slash-commands.md index e243a476a..008e5662a 100644 --- a/docs/user-guide/04-slash-commands.md +++ b/docs/user-guide/04-slash-commands.md @@ -179,7 +179,7 @@ List installed plugins. `/plugin` is an alias. ### `/skills` -Browse installed skills from the community registry. +Browse installed skills. ``` /skills @@ -187,20 +187,21 @@ Browse installed skills from the community registry. ### `/skills search ` -Search the community registry for skills. +Search the community registry. The registry index is not published yet, so this +currently returns no results; install directly with `/skills install`. ``` /skills search go /skills search review ``` -### `/skills install ` +### `/skills install [name]` -Install a skill from a source. +Install all skills, or one named skill, from a public GitHub repository. ``` -/skills install go-review -reflect skills install go-review +/skills install GrayCodeAI/skills go-review +reflect skills install GrayCodeAI/skills go-review ``` ### `/skills audit` diff --git a/docs/user-guide/08-skills.md b/docs/user-guide/08-skills.md index c0c73c39b..c27d4af7a 100644 --- a/docs/user-guide/08-skills.md +++ b/docs/user-guide/08-skills.md @@ -14,15 +14,17 @@ Use a skill for a repeatable procedure that's too specific for AGENTS.md but too ## Skill Locations -Reflect discovers skills from these directories, in priority order: +Reflect discovers skills from these directories: -| Location | Scope | Priority | -|----------|-------|----------| -| `.reflect/skills/`, `.reflect/commands/` | Local (CWD) | Highest | -| `/.reflect/skills/` | Repo | Medium | -| `~/.reflect/skills/` | User | Lowest | +| Location | Scope | +|----------|-------| +| `~/.reflect/skills/` | User | +| `.reflect/skills/` | Project (requires folder trust) | +| `.zero/skills/` | Project, legacy alias (requires folder trust) | +| `skills/` | Project, plain directory (requires folder trust) | -Higher-priority locations override skills with the same name. +Each directory holds one subdirectory per skill, and each of those contains a +`SKILL.md`. --- @@ -75,9 +77,13 @@ Review staged changes and create a commit with a clear, conventional message. | Field | Description | |-------|-------------| | `allowed-tools` | Tools the skill uses | -| `user-invocable` | Whether you can run the skill as a slash command (default: `true`) | -| `disable-model-invocation` | When `true`, only slash command runs the skill | +| `user-invocable` | Whether you can run the skill as a slash command | +| `model-invocable` | Whether Reflect may invoke the skill automatically | +| `invocable` | Shorthand: `user`, `model`, `all`, or `none` | | `license` | License identifier | +| `version`, `author`, `category`, `tags` | Display and marketplace metadata | +| `auto-invoke` | `true` to let Reflect choose the skill without an explicit mention | +| `paths` | Glob paths where the skill applies | --- @@ -100,7 +106,8 @@ Pass arguments after the name: ### Qualified Names -When names collide, use qualified forms: +The slash command is the directory name. To avoid a collision, invoke the skill +by its qualified `scope:name` form: ``` /local:commit # From ./.reflect/skills/ @@ -109,7 +116,8 @@ When names collide, use qualified forms: ### Automatic Invocation -Reflect can invoke a skill automatically when it recognizes a relevant task. Write specific descriptions in the `description` and `when-to-use` fields. +Reflect can invoke a skill automatically when it recognizes a relevant task. +Write a specific `description`, or set `auto-invoke: true` and optional `paths`. --- @@ -118,29 +126,29 @@ Reflect can invoke a skill automatically when it recognizes a relevant task. Wri Manage skills from the command line: ```bash -# Search the community registry -reflect skills search go - -# Install a skill from a source -reflect skills install go-review - -# Audit installed skills for security -reflect skills audit +reflect skills list # list installed skills +reflect skills info # show one skill's details +reflect skills install [name] # install all or one skill +reflect skills remove # uninstall +reflect skills audit # security-scan installed skills ``` --- ## Installing Skills -Reflect ships **no bundled skills** by default. Skills are installed on demand -from the separate `GrayCodeAI/starling` repo (or any GitHub repo): +Reflect ships **no bundled skills** by default. Install them directly from any +public GitHub repository: ```bash -reflect skills search # find a skill in the registry reflect skills install [skill] # install after user approval reflect skills audit # security-scan installed skills ``` +`reflect skills search` and `reflect skills trending` exist but depend on a +community registry index that is not published yet, so they currently report no +results. Install from a repository you trust instead. + Once installed, skills are discovered from the locations listed above. ### Install-time security and the lockfile diff --git a/examples/README.md b/examples/README.md index 7a9820c3a..160e8c783 100644 --- a/examples/README.md +++ b/examples/README.md @@ -52,35 +52,36 @@ reflect install step and provider secrets before enabling the job. ### Report CI delivery context Copy [reflect-delivery-context.yml](github/reflect-delivery-context.yml) to your -repository to report GitHub Actions runs to Reflect Cloud. Create a dedicated, +repository to report GitHub Actions runs to GrayCode Cloud. Create a dedicated, revocable device token for CI and keep its endpoint, device ID, project ID, and token in GitHub Actions secrets. ## MCP Integration -Reflect can use MCP servers for extended capabilities: - -```bash -# With harrier for persistent memory -harrier setup -reflect chat - -# With swift for session capture -swift start -reflect "refactor the API layer" -swift stop -``` - -## Configuration - -Create `.reflect/config.json`: +Reflect can use MCP servers for extended capabilities. Configure them as an +`mcp_servers` array in `settings.json` (global `~/.reflect/settings.json` or +project `.reflect/settings.json`): ```json { - "model": "claude-sonnet-4-6", - "maxTokens": 8192, - "temperature": 0.7 + "mcp_servers": [ + { + "name": "filesystem", + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"], + "type": "stdio" + } + ] } ``` -See the [main README](../README.md) for full documentation. +Tools are exposed to the agent as `mcp__filesystem__`. See +[docs/mcp-servers.md](../docs/mcp-servers.md) for the full schema and the +`reflect mcp serve|config` commands. + +## Configuration + +Reflect reads `~/.reflect/settings.json` and, after you trust the folder, +`.reflect/settings.json` for project overrides. Model, provider, and permission +settings live there; see the [main README](../README.md) for full +documentation. diff --git a/llms.txt b/llms.txt index bb1682c02..3910bf61b 100644 --- a/llms.txt +++ b/llms.txt @@ -36,7 +36,7 @@ Run all of these before proposing changes: ## Docs -- [docs/README.md](docs/README.md) — index for `docs/`; points to the canonical repo inventory in graycode-eco. +- [docs/README.md](docs/README.md) — index for `docs/`. - [docs/architecture.md](docs/architecture.md) — reflect architecture overview. - [docs/BENCHMARKS.md](docs/BENCHMARKS.md) — published, reproducible CPU benchmarks (machine + commit recorded). - [docs/compatibility.md](docs/compatibility.md) — compatibility matrix; independent SemVer per repo. @@ -78,11 +78,11 @@ From AGENTS.md; deeper detail in docs/user-guide/ and docs/plugin-development.md - Project instructions: on launch, reflect walks from the working directory up to the nearest git root and injects the first match per directory level, priority `AGENTS.md` > `ZERO.md` > `.zero/AGENTS.md` (case-insensitive basename). Read once at session start; ~8 KiB per file, 32 KiB total cap. - Personal instructions: `~/.reflect/ZERO.md` (Windows: `%AppData%\reflect\ZERO.md`), injected as `## User guidelines` before project rules; project rules take precedence on conflict. -- Specialists (sub-agents): scopes are built-in > user `~/.reflect/specialists/*.md` > project `./.zero/specialists/*.md`; project overrides user overrides built-in on name collision. Managed with `reflect specialist list|show|create|edit|delete|path`. -- Skills: none bundled by default; markdown instruction files sourced from the separate GrayCodeAI/graycode-skills repo and installed on demand via `reflect skills search|install|list|remove`. Installed to `~/.reflect/skills/` (user) or `./.zero/skills/` / `./skills/` (project). -- Hooks: `beforeReview`, `afterReview`, `sessionStart`, `sessionEnd` — managed with `reflect hook add|remove|list` (e.g. `reflect hook add beforeReview --command "lint-check"`). -- MCP servers: `reflect mcp add --name --url `, `reflect mcp remove `, `reflect mcp list`; configuration detail in docs/mcp-servers.md. -- Plugins: `reflect plugin add --name --path `, `reflect plugin remove `, `reflect plugin list`; guide in docs/plugin-development.md. +- Custom agents (sub-agent personas): stored only in Reflect user state at `~/.reflect/agents/*.md`; managed with `reflect agent list|create|show|remove`. Frontmatter supports `name`, `description`, and `model`. +- Skills: none bundled by default; markdown instruction files installed from any public GitHub repository with `reflect skills install [skill-name]`, listed with `reflect skills list`, removed with `reflect skills remove `. Installed to `~/.reflect/skills/` (user) or Reflect's project state `skills/` directory. There is no published community index, so `reflect skills search` is unavailable. +- Hooks: file-based only (no `reflect hook` CLI). One Markdown file per hook under `.reflect/hooks/` with frontmatter `name`, `event`, `pattern`, `command`, `timeout`, `async`; canonical events include `session_start`, `user_prompt_submit`, `pre_tool`, `post_tool`, `post_tool_failure`, `pre_compact`/`post_compact`, `file_changed`, `permission_ask`/`permission_result`, `subagent_start`/`subagent_stop`, `task_started`, `session_heartbeat`, `stop`/`stop_failure`, `failure`, `interrupt`, `notification`, and `test_result`. +- MCP servers: configured as an `mcp_servers` array in `settings.json` with `name`, `command`, `args`, `type`, `url`, `headers`, `client_id`; tools are exposed as `mcp____`. The CLI only covers Reflect acting as an MCP server: `reflect mcp serve` and `reflect mcp config`. Detail in docs/mcp-servers.md. +- Plugins: `reflect plugin list|install|uninstall|inspect|activate|deactivate|reload|status|logs|create|marketplace`; `plugin.json` manifest plus optional `skills/`, `hooks/`, and `mcp.json`. Guide in docs/plugin-development.md. ## Contracts and boundaries @@ -111,5 +111,3 @@ From AGENTS.md; deeper detail in docs/user-guide/ and docs/plugin-development.md - SECURITY.md — report privately via a GitHub Security Advisory or security@reflect.ai; do not open public issues for vulnerabilities. - docs/README.md — the docs index. - Relay (model runtime): https://github.com/GrayCodeAI/relay -- graycode-skills (skill registry): https://github.com/GrayCodeAI/graycode-skills -- Canonical sibling inventory: https://github.com/GrayCodeAI/graycode-eco/blob/main/ecosystem.yaml From a642f3af156d8fc54e2cb5bbaf4ede09c4907460 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Wed, 2 Dec 2026 19:42:19 +0530 Subject: [PATCH 3/5] fix(action): select the provider through the CLI --- .github/actions/reflect/action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/reflect/action.yml b/.github/actions/reflect/action.yml index 5ee7a3aa3..bced5bf9b 100644 --- a/.github/actions/reflect/action.yml +++ b/.github/actions/reflect/action.yml @@ -23,7 +23,7 @@ inputs: description: >- Provider id to activate (for example openai, anthropic, gemini, ollama, or any configured OpenAI-/Anthropic-compatible endpoint). Optional when the - repository already carries a .zero/config.json with an active provider. + repository already carries a .reflect/settings.json with an active provider. required: false default: "" api-key: @@ -215,8 +215,10 @@ runs: fi export "${REFLECT_INPUT_API_KEY_ENV}=${REFLECT_INPUT_API_KEY}" fi + # Select the provider through the CLI; Reflect reads the active provider + # from Relay's provider.json, not from an environment variable. if [ -n "${REFLECT_INPUT_PROVIDER}" ]; then - export REFLECT_PROVIDER="${REFLECT_INPUT_PROVIDER}" + reflect config provider "${REFLECT_INPUT_PROVIDER}" fi args=(exec) From 54b75b7c0f65336eebf2eb128a15f10ec8fd8c5b Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Wed, 2 Dec 2026 19:43:53 +0530 Subject: [PATCH 4/5] docs: mark retired ecosystem docs historical --- docs/ECOSYSTEM-ROADMAP.md | 9 ++++++++- docs/ECOSYSTEM-WIRING.md | 16 +++++++++++----- docs/design/REFLECT-CLOUD-SAAS.md | 7 ++++++- examples/github/reflect-delivery-context.yml | 10 +++++----- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/docs/ECOSYSTEM-ROADMAP.md b/docs/ECOSYSTEM-ROADMAP.md index 36a34e42c..c7f8b2358 100644 --- a/docs/ECOSYSTEM-ROADMAP.md +++ b/docs/ECOSYSTEM-ROADMAP.md @@ -1,6 +1,13 @@ # GrayCode Ecosystem Roadmap (2026) -**Status:** Active · **Last updated:** 2026-09-09 +> **HISTORICAL (2026-09-09 snapshot).** This roadmap describes the workspace as +> it stood before the 1.0 releases, including repositories and engine modules +> that were never published. The current products are **Reflect** and +> **Relay**, with **GrayCode Cloud** as the optional hosted control plane. For +> current behavior see [`AGENTS.md`](../AGENTS.md), [`docs/architecture.md`](./architecture.md), +> and the repository `VERSION` files. + +**Status:** Historical · **Last updated:** 2026-09-09 **Scope:** the 4 in-workspace repos — `reflect`, `relay`, `graycode-skills`, `graycode-platform` — plus the 5 external engine repos they depend on. diff --git a/docs/ECOSYSTEM-WIRING.md b/docs/ECOSYSTEM-WIRING.md index df69f9c6a..2a1263a14 100644 --- a/docs/ECOSYSTEM-WIRING.md +++ b/docs/ECOSYSTEM-WIRING.md @@ -1,12 +1,18 @@ # GrayCode ecosystem wiring +> **HISTORICAL.** This document is an implementation contract from 2026-09 and +> describes repositories and engine modules that no longer exist. The current +> products are **Reflect** and **Relay**, with **GrayCode Cloud** as the +> optional hosted control plane. Use [`AGENTS.md`](../AGENTS.md), +> [`docs/architecture.md`](./architecture.md) and the repository `VERSION` files +> for current behavior. +> > **STALE (2026-09-18):** Diagrams below predate `eagle` removal (2026-09-04) and list 14 repos / 6 engines. > NOTE (2026-09-04): `eagle` contracts vendored into `reflect/internal/contracts`. -> **INVENTORY MOVED (2026-10-02):** the canonical machine-readable inventory is -> [`GrayCodeAI/graycode-eco/ecosystem.yaml`](https://github.com/GrayCodeAI/graycode-eco/blob/main/ecosystem.yaml) -> (10 products, including `beam`). The `ecosystem.yaml` in this repo is -> deprecated and incomplete. Use that file for workspace and boundary checks; -> `scripts/ecosystem-manifest.sh` already reads it. +> **INVENTORY MOVED (2026-10-02):** the cross-repo inventory was meant to live +> outside this repository; it is not published. The `ecosystem.yaml` here is +> deprecated and incomplete. `scripts/ecosystem-manifest.sh` still reads it as +> a fallback. This document is the historical implementation contract. diff --git a/docs/design/REFLECT-CLOUD-SAAS.md b/docs/design/REFLECT-CLOUD-SAAS.md index 20c9e36d3..85f14485e 100644 --- a/docs/design/REFLECT-CLOUD-SAAS.md +++ b/docs/design/REFLECT-CLOUD-SAAS.md @@ -1,6 +1,11 @@ # Reflect Cloud — Hosted Execution Plane (Design Doc) -**Status:** Draft / Proposal +> **HISTORICAL (2026-06-06).** This is a proposal written before the hosted +> control plane was named **GrayCode Cloud**. "Reflect Cloud" in this document +> means today's GrayCode Cloud. See [`docs/architecture.md`](../architecture.md) +> for current behavior. + +**Status:** Historical proposal **Author:** Platform team **Last updated:** 2026-06-06 **Scope:** Multi-month product effort. This is a design a team executes against, not a code-session deliverable. diff --git a/examples/github/reflect-delivery-context.yml b/examples/github/reflect-delivery-context.yml index f8b843b6d..951909d48 100644 --- a/examples/github/reflect-delivery-context.yml +++ b/examples/github/reflect-delivery-context.yml @@ -4,8 +4,8 @@ # `reflect` is available on PATH (install it using your team's normal release # mechanism before this reporting step). # -# Create a dedicated, revocable Reflect Cloud device token for CI. Do not reuse a -# developer's local device token. Store all three values as repository secrets. +# Create a dedicated, revocable GrayCode Cloud device token for CI. Do not reuse +# a developer's local device token. Store all three values as repository secrets. name: Reflect Delivery Context on: @@ -25,13 +25,13 @@ jobs: # Install Reflect here using the release package your organization pins. # The remaining steps are intentionally independent of the installer. - - name: Connect CI device to Reflect Cloud + - name: Connect CI device to GrayCode Cloud run: | - reflect cloud connect \ + printf '%s' "$REFLECT_CLOUD_DEVICE_TOKEN" | reflect cloud connect \ --endpoint "$REFLECT_CLOUD_URL" \ --device-id "$REFLECT_CLOUD_DEVICE_ID" \ --project-id "$REFLECT_CLOUD_PROJECT_ID" \ - --token "$REFLECT_CLOUD_DEVICE_TOKEN" + --token-stdin env: REFLECT_CLOUD_URL: ${{ secrets.REFLECT_CLOUD_URL }} REFLECT_CLOUD_DEVICE_ID: ${{ secrets.REFLECT_CLOUD_DEVICE_ID }} From 3d02742ae0b2265360ad1417c0fc891c746d4fb5 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Wed, 2 Dec 2026 20:00:31 +0530 Subject: [PATCH 5/5] docs: correct the current provider count --- docs/COMPETITIVE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/COMPETITIVE.md b/docs/COMPETITIVE.md index c4bee0a22..8287e34a4 100644 --- a/docs/COMPETITIVE.md +++ b/docs/COMPETITIVE.md @@ -63,7 +63,7 @@ External star counts below are approximate web-search snapshots (2026-09-08), no 1. **Traction.** reflect has no star-moat. Leaders won via day-1 provider-agnostic + one-liner install + Web/Desktop alongside TUI. reflect ships the verified install script and `go install` today (`README.md` Install) — keep, don't add Desktop. 2. **Language/distro.** Go+MIT+zero-CGO (`Makefile:54`, `go.mod:3`) matches `gh/fzf/lazygit` enterprise-safe profile. Avoid GPL/EUPL patterns (kitty/eza). Rust wave wins on published benchmarks — reflect has `make bench` but publishes none (Gap-04). -3. **Providers.** reflect routes only via `relay/engine` facade (`docs/SECURITY-DEVELOPER.md:51-56`; facade declared in `GrayCodeAI/graycode-eco/ecosystem.yaml`); custom OpenAI-compat supported (`internal/config/settings.go:50`). Count messaging ("28 first-class" per README) trails OpenCode 75+ / Hermes 300+ — fix by exposing catalog count dynamically, not by forking providers into CLI (ownership lives in router per AGENTS.md). +3. **Providers.** reflect routes only via the `relay/engine` facade (`docs/SECURITY-DEVELOPER.md:51-56`; see [`AGENTS.md`](../AGENTS.md)); custom OpenAI-compat is supported (`internal/config/settings.go:50`). The catalog currently ships 29 first-class providers, behind OpenCode's 75+ / Hermes's 300+ — fix by exposing the catalog count dynamically, not by forking providers into the CLI (ownership lives in relay per AGENTS.md). 4. **TUI/UX.** Bubble Tea v2 + vim keys + `/autonomy` + `/spec` + watch `AI!`/`AI?` + visual diff is competitive. Missing vs field: hosted share-link (ours is local `reflect://` deeplink), multi-session grid (we have `mission` worktrees + daemon — unsurfaced like herdr/cmux). Gap-02. 5. **Execution safety.** Host execution keeps onboarding simple, but requires strong permission, path, approval, and audit controls. Keep those controls explicit and testable; do not add a hidden execution backend. 6. **Memory/context.** AST repomap + Harrier graph + compaction segments + relevance-prune + conversation-arc + 80% tool-result clearing exceeds most. Missing: Hermes-style auto-skill learning loop (we have curator archive + harness — surface it).