The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Add publishable Beacon memory Agent Skills for every major harness
Claude3b3b2e3fcf4d
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonnew file mode 100644index 00000000..5284dcd7--- /dev/null+++ b/.claude-plugin/marketplace.json@@ -0,0 +1,18 @@+{+ "name": "beacon",+ "owner": {+ "name": "Asymptote Labs",+ "url": "https://asymptotelabs.ai"+ },+ "description": "Beacon plugins for AI coding agents.",+ "plugins": [+ {+ "name": "beacon",+ "source": "./agent-skills",+ "description": "Cross-harness memory from Beacon traces: recall reviewed project lessons, distill agent sessions into approved memory, and promote memory to Agent Skills.",+ "version": "0.1.0",+ "category": "productivity",+ "tags": ["memory", "traces", "observability"]+ }+ ]+}diff --git a/.claude/skills/self-verify-beacon-in-sandbox/SKILL.md b/.claude/skills/self-verify-beacon-in-sandbox/SKILL.mdindex 6103bad9..c1d39965 100644--- a/.claude/skills/self-verify-beacon-in-sandbox/SKILL.md+++ b/.claude/skills/self-verify-beacon-in-sandbox/SKILL.md@@ -1,6 +1,8 @@---name: self-verify-beacon-in-sandboxdescription: Verify a Beacon change end to end by running a real Claude Code session inside a disposable Linux cloud sandbox and checking that Beacon captured what the agent actually did. Use when asked to verify, validate, test, or prove that a Beacon change works for real rather than just compiling; when asked whether telemetry, event capture, commands, file paths, prompts, tokens, or approvals are still recorded correctly; when investigating a suspected capture gap; or when preparing a Beacon pull request that touches the CLI, hooks, or the collector exporter.+metadata:+ internal: true---# Verify Beacon in a sandboxdiff --git a/CLAUDE.md b/CLAUDE.mdindex 0f911c4d..9d0a3cd2 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -13,6 +13,7 @@ Beacon Endpoint Agent is a local-only endpoint telemetry agent for AI runtimes.- `browser-extension`: optional MV3 collector (Chrome, plus a beta Firefox build target) that relays Claude.ai and ChatGPT chat telemetry into the local pipeline as OTLP.- `pkg/asymptoteobserve`: shared Go library — event schema, harness-name normalization, provenance markers, token usage, and the threat-rules engine. Imported by the CLI, the hook adapter, and the collector exporter, so a change here reaches all three.- `plugins`: TypeScript sources for the managed runtime plugins/extensions (`opencode-beacon`, `cline-beacon`, `pi-beacon`, `omp-beacon`, `openclaw-beacon`, `prime-beacon`, `omo-beacon`), each mirrored into an embedded copy under `cli/beacon/internal/endpoint/hooks/assets/`.+- `agent-skills`: publishable Agent Skills plugin for the traces-to-memory workflow (`beacon-memory-recall`, `beacon-memory-distill`, `beacon-memory-promote`) with manifests for Claude Code, Agent Plugins (Codex, Cursor, Copilot, Kiro), and Gemini CLI; the marketplace entry is the repo-root `.claude-plugin/marketplace.json`. `cli/beacon/cmd/agent_skills_test.go` checks every `beacon` command and flag the skills name against the real command tree, so rename a command and update the skills together.- `rules` and `spec/threat-rules`: the open rule corpus and the Threat Rules format it conforms to.- `beacon-sandbox`: harness that runs a real Claude Code session in a disposable sandbox and checks what Beacon captured. See `beacon-sandbox/AGENTS.md`.- `packaging`: macOS, Linux, and Windows packaging and deployment assets.diff --git a/agent-skills/.claude-plugin/plugin.json b/agent-skills/.claude-plugin/plugin.jsonnew file mode 100644index 00000000..0c557dfb--- /dev/null+++ b/agent-skills/.claude-plugin/plugin.json@@ -0,0 +1,14 @@+{+ "name": "beacon",+ "displayName": "Beacon memory",+ "version": "0.1.0",+ "description": "Cross-harness memory from Beacon traces: recall reviewed project lessons, distill agent sessions into approved memory, and promote memory to Agent Skills.",+ "author": {+ "name": "Asymptote Labs",+ "url": "https://asymptotelabs.ai"+ },+ "homepage": "https://docs.asymptotelabs.ai/concepts/cross-harness-memory",+ "repository": "https://github.com/asymptote-labs/agent-beacon",+ "license": "MIT",+ "keywords": ["memory", "traces", "observability", "agent-skills", "beacon", "mcp"]+}diff --git a/agent-skills/.mcp.json b/agent-skills/.mcp.jsonnew file mode 100644index 00000000..a1418b7c--- /dev/null+++ b/agent-skills/.mcp.json@@ -0,0 +1,8 @@+{+ "mcpServers": {+ "beacon": {+ "command": "beacon",+ "args": ["mcp", "serve"]+ }+ }+}diff --git a/agent-skills/LICENSE b/agent-skills/LICENSEnew file mode 100644index 00000000..7ab28593--- /dev/null+++ b/agent-skills/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 Asymptote Labs++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/agent-skills/README.md b/agent-skills/README.mdnew file mode 100644index 00000000..fd431ad2--- /dev/null+++ b/agent-skills/README.md@@ -0,0 +1,77 @@+# Beacon memory skills++Agent Skills that turn Beacon's cross-harness traces into reviewed project memory, and+bring that memory back to any agent in any harness.++| Skill | What it does | Network |+|-------|--------------|---------|+| `beacon-memory-recall` | Before a task, fetch approved project memory (MCP `get_memory_context`, or `beacon memory list`). | None |+| `beacon-memory-distill` | Pick traces, score them with the evaluator after a dry run and the user's yes, read each candidate's source trace, draft a grounded lesson, and approve it with the user. | Evaluator call only, with consent |+| `beacon-memory-promote` | Install an approved memory as `.agents/skills/<slug>/SKILL.md` so harnesses load it automatically. | None |++All three need the [Beacon CLI](https://docs.asymptotelabs.ai/get-started) with endpoint+capture installed. The plugin also registers the local `beacon mcp serve` server for+harnesses that take MCP servers from plugins.++## Install++| Harness | Command |+|---------|---------|+| Claude Code | `/plugin marketplace add asymptote-labs/agent-beacon`, then `/plugin install beacon@beacon` |+| Codex | `codex plugin marketplace add asymptote-labs/agent-beacon` |+| GitHub Copilot CLI | `copilot plugin marketplace add asymptote-labs/agent-beacon`, then `copilot plugin install beacon@beacon` |+| Factory Droid | `droid plugin marketplace add asymptote-labs/agent-beacon`, then `droid plugin install beacon@beacon` |+| Gemini CLI | `gemini extensions install https://github.com/asymptote-labs/agent-beacon` (see the note below) |+| Any skills-capable agent (Cursor, OpenCode, Amp, goose, Cline, Windsurf, Kiro, …) | `npx skills add asymptote-labs/agent-beacon` |++## Layout++This directory is a self-contained plugin root. Every harness reads the same `skills/`.++```text+agent-skills/+ plugin.json Agent Plugins 1.0 manifest (Codex, Cursor, Copilot, VS Code, Kiro)+ mcp.json Agent Plugins MCP config+ .claude-plugin/plugin.json Claude Code (also read by Factory Droid)+ .mcp.json Claude Code MCP config+ gemini-extension.json Gemini CLI extension manifest+ skills/<name>/SKILL.md agentskills.io format, shared by all+../.claude-plugin/marketplace.json+ Marketplace entry, read by Claude Code, Codex, Copilot,+ Factory Droid, and the skills CLI+```++`cli/beacon/cmd/agent_skills_test.go` fails when a skill names a `beacon` command or flag+that does not exist, when frontmatter breaks the Agent Skills spec, or when the manifests+disagree on name or version.++## Releasing a new version++1. Bump `version` in `plugin.json`, `.claude-plugin/plugin.json`, `gemini-extension.json`,+ the marketplace entry, and each skill's `metadata.version`. The Go test enforces this.+2. Run `go test ./cmd -run AgentSkills` in `cli/beacon`, and `claude plugin validate --strict agent-skills`.+3. Merge to `main`. Marketplaces that track the repository pick up the change. Listings+ that pin a commit (the Claude community marketplace) need that commit updated.++## Publishing checklist++| Destination | How | Status |+|-------------|-----|--------|+| Claude Code community marketplace | Submit the repository at https://platform.claude.com/plugins/submit. Listings are pinned to a commit. | To do |+| Cursor Marketplace | Submit at https://cursor.com/marketplace/publish (manual review, needs a public repo with a README). | To do |+| Kiro Powers | Submit at https://kiro.dev/powers/submit/ (Agent Plugins format). | To do |+| OpenAI plugin directory (ChatGPT and Codex) | Submit through OpenAI's plugin submission portal. | To do |+| GitHub `awesome-copilot` | Open a pull request adding the plugin. | To do |+| skills.sh | Nothing to submit. It lists skills by install count. | Automatic |+| SkillsMP | Nothing to submit. It crawls public repositories with at least two stars. | Automatic |+| Gemini CLI gallery | Needs `gemini-extension.json` at the root of a repository with the `gemini-cli-extension` topic. | Needs a mirror repo (below) |++### Gemini and the mirror repository++Gemini CLI reads `gemini-extension.json` from the root of the repository it installs, and+its gallery crawls repositories by topic. The Beacon monorepo is not a good extension+root, because installing it would clone everything. Mirror this directory verbatim to a+small repository (for example `asymptote-labs/beacon-skills`), tag the+`gemini-cli-extension` topic there, and use that repository for the Gemini gallery, the+Cursor and Kiro submissions, and anywhere else that wants the plugin at the repository+root. Everything in this directory already works as a repository root.diff --git a/agent-skills/gemini-extension.json b/agent-skills/gemini-extension.jsonnew file mode 100644index 00000000..581a7f09--- /dev/null+++ b/agent-skills/gemini-extension.json@@ -0,0 +1,11 @@+{+ "name": "beacon",+ "version": "0.1.0",+ "description": "Cross-harness memory from Beacon traces: recall reviewed project lessons, distill agent sessions into approved memory, and promote memory to Agent Skills.",+ "mcpServers": {+ "beacon": {+ "command": "beacon",+ "args": ["mcp", "serve"]+ }+ }+}diff --git a/agent-skills/mcp.json b/agent-skills/mcp.jsonnew file mode 100644index 00000000..54235f6f--- /dev/null+++ b/agent-skills/mcp.json@@ -0,0 +1,10 @@+{+ "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",+ "mcpServers": {+ "beacon": {+ "type": "stdio",+ "command": "beacon",+ "args": ["mcp", "serve"]+ }+ }+}diff --git a/agent-skills/plugin.json b/agent-skills/plugin.jsonnew file mode 100644index 00000000..3c2f0ae4--- /dev/null+++ b/agent-skills/plugin.json@@ -0,0 +1,14 @@+{+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",+ "name": "beacon",+ "version": "0.1.0",+ "description": "Cross-harness memory from Beacon traces: recall reviewed project lessons, distill agent sessions into approved memory, and promote memory to Agent Skills.",+ "author": {+ "name": "Asymptote Labs",+ "url": "https://asymptotelabs.ai"+ },+ "homepage": "https://docs.asymptotelabs.ai/concepts/cross-harness-memory",+ "repository": "https://github.com/asymptote-labs/agent-beacon",+ "license": "MIT",+ "keywords": ["memory", "traces", "observability", "agent-skills", "beacon", "mcp"]+}diff --git a/agent-skills/skills/beacon-memory-distill/SKILL.md b/agent-skills/skills/beacon-memory-distill/SKILL.mdnew file mode 100644index 00000000..77a994b5--- /dev/null+++ b/agent-skills/skills/beacon-memory-distill/SKILL.md@@ -0,0 +1,179 @@+---+name: beacon-memory-distill+description: Turn recorded agent sessions (Beacon traces from Claude Code, Cursor, Codex, OpenCode, and other harnesses) into reviewed, reusable project memory. Scores selected traces, reads the source trace behind each high-signal candidate, drafts a grounded lesson, and approves it only after the user confirms. Use when the user asks to "learn from", "remember", "save the lesson from", or "turn into memory" a recent session, fix, or debugging effort, or asks to review Beacon memory candidates.+license: MIT+compatibility: Requires the Beacon CLI (beacon) on PATH with endpoint capture installed. Scoring calls the configured Jev evaluator over the network (hosted TypeSafe by default) and needs TYPESAFE_API_KEY or BEACON_JEV_API_KEY; every other step is local.+metadata:+ author: asymptote-labs+ homepage: https://docs.asymptotelabs.ai/concepts/cross-harness-memory+ version: "0.1.0"+---++# Beacon memory distill: traces to memory++Beacon captures what agents do in every supported harness. This skill runs the review+loop that turns a few of those sessions into **approved project memory** that any later+agent can recall, whichever harness it runs in:++1. Pick traces.+2. Score them with the evaluator (the one networked step, and only with consent).+3. For each candidate, read the source trace and draft the lesson.+4. The user confirms, edits, or rejects each draft.+5. Approve with the reviewed text.++The evaluator returns probabilities only. It says a trace looks reusable; it does not say+what the lesson is. **You write the lesson, from the trace, and the user approves it.**+Never approve a candidate with its placeholder body ("no lesson text was extracted").++Run every command from inside the repository the memory is for, or pass+`--project <path>`.++## Step 1: preflight++```bash+beacon version+beacon endpoint traces status --json+```++- If `beacon` is missing, stop and point the user to+ https://docs.asymptotelabs.ai/get-started. Do not install it yourself.+- If the trace store is empty or stale, rebuild it (local only, never touches the log):+ `beacon endpoint traces reindex`.++## Step 2: pick traces++Use what the user named: a session, a date, a harness, or a topic. Otherwise list recent+traces and propose a short set (up to 10) that look like finished work with a correction,+a fix, or a non-obvious procedure.++```bash+beacon endpoint traces list --json --limit 20+beacon endpoint traces list --json --limit 20 -q "<topic terms>"+beacon endpoint traces search "<error text or file>" --json --limit 10+```++Prefer traces from this repository. Skip trivial sessions (a single question, an+abandoned attempt) since they cost evaluator calls and yield nothing.++## Step 3: dry run, then ask++The dry run is local. It shows the traces selected and the estimated cost:++```bash+beacon memory evaluations run --dry-run --trace <trace-id>+beacon memory evaluations run --dry-run --limit 10 --harness <name> --since <rfc3339>+```++Before the real run, tell the user plainly and **wait for an explicit yes**:++- Each selected trace is sent, as a bounded and redacted projection, to the evaluator at+ `BEACON_JEV_ENDPOINT` if that is set, otherwise to the hosted TypeSafe endpoint.+- It costs about the estimate the dry run printed.+- Nothing is approved or written into memory by this step.++Check for a key without printing it:++```bash+test -n "${TYPESAFE_API_KEY:-}${BEACON_JEV_API_KEY:-}" && echo "evaluator key present" || echo "no evaluator key"+```++With no key, stop and tell the user to export `TYPESAFE_API_KEY` (or point+`BEACON_JEV_ENDPOINT` at their organization's compatible evaluator). Never ask them to+paste a key into the chat, and never pass `--jev-api-key` on the command line. If the user+or their organization does not allow external evaluation, stop here: candidates come only+from evaluations.++## Step 4: score++Repeat the exact selection the user approved, without `--dry-run`:++```bash+beacon memory evaluations run --trace <trace-id> --json+beacon memory evaluations run --limit 10 --harness <name> --since <rfc3339> --json+```++A trace becomes a candidate only when `task_success` is at least 0.50 and the mean score+is at least 0.60. Report how many were scored and how many became candidates. The text+output names why each trace was not promoted; do not try to overturn that.++## Step 5: draft a lesson for each candidate++```bash+beacon memory candidates list --state candidate --json+beacon memory candidates show <candidate-id> --json+```++For each candidate, read its evidence trace:++```bash+beacon endpoint traces show <trace-id> --json --limit 400+beacon endpoint traces show <trace-id> --json --offset 401 --limit 400+beacon endpoint traces show <trace-id> --json --around-event <n> --before 5 --after 5+```++Work out, from the events themselves:++- What the task was (the first prompt).+- What went wrong or was non-obvious: a failed command, a correction from the user, a+ retry, a wrong assumption that got reversed.+- What finally worked, with the specific command, file, flag, or order of steps.+- How the agent confirmed it worked (a passing test, a clean build).++Then check whether it is already known:++```bash+beacon memory list --json -q "<two or three distinctive terms>"+```++Draft each lesson in the shape given in [references/lesson-quality.md](references/lesson-quality.md):+title, kind, applicability, body, tags, and the event numbers it rests on. Read that file+before writing your first draft.++Recommend **reject** when the trace has no transferable lesson (it was routine, too+specific to one moment, or the fix was later reverted), and **supersede** when an+existing memory already says the same thing.++## Step 6: review with the user++Show every draft at once, each with its recommendation (approve, reject, or supersede),+the candidate ID, and the trace events that support it. Ask the user to confirm or edit+each one. Do not approve, reject, or supersede anything they have not confirmed. Silence+is not approval.++## Step 7: record the decisions++Approve with the reviewed text. Pass the body on stdin so quoting stays safe:++```bash+beacon memory candidates approve <candidate-id> \+ --title "<title>" \+ --kind <workflow|correction|debugging_pattern|gotcha|convention> \+ --applicability "<when this applies>" \+ --tag <tag> --tag <tag> \+ --reason "Reviewed with the user; lesson drafted from trace events <n>-<m>" \+ --body-file - --json <<'LESSON'+<body>+LESSON+```++```bash+beacon memory candidates reject <candidate-id> --reason "<why it is not reusable>"+beacon memory candidates supersede <candidate-id> --replacement <memory-id> --reason "<which memory already covers it>"+```++Confirm what was stored with `beacon memory show <memory-id>`, then summarize: approved,+rejected, superseded, and the new memory IDs. Mention that any agent in any harness can+now recall these with the `beacon-memory-recall` skill or the Beacon MCP tools, and that a+memory worth loading automatically can be installed as a skill with+`beacon-memory-promote`.++## Boundaries++- The evaluation run is the only networked step. Run it only after the dry run and the+ user's explicit yes, and only on the selection they approved.+- Memory is shared with every future agent in this project. Never put secrets, tokens,+ credentials, internal hostnames, customer data, or personal information into a title,+ body, tag, or reason, even when the trace contains them. Describe them instead ("the+ staging API key from 1Password").+- Quote trace content sparingly and only to support a draft.+- Never edit `memory.db` or the runtime log directly. Use the CLI.diff --git a/agent-skills/skills/beacon-memory-distill/references/lesson-quality.md b/agent-skills/skills/beacon-memory-distill/references/lesson-quality.mdnew file mode 100644index 00000000..a49af13e--- /dev/null+++ b/agent-skills/skills/beacon-memory-distill/references/lesson-quality.md@@ -0,0 +1,58 @@+# Writing a Beacon memory lesson++A memory is read by a future agent that has never seen the original session, often in a+different harness, at the start of an unrelated task. Write for that reader.++## Shape++| Field | Rule |+|-------|------|+| `--title` | Imperative, specific, under 80 characters. It is the search hit and the skill description, so name the tool, file, or error. |+| `--kind` | One of the five kinds below. |+| `--applicability` | Starts with "when", "before", or "after". Names the trigger a future agent would recognise, such as a file path, a command, or an error string. |+| body | 3–10 lines. First, what to do. Then why, in one sentence, from the trace. Then how to confirm it worked. Use exact commands and paths in backticks. |+| `--tag` | 2–4 lowercase tags: the subsystem, the tool, the harness only if it matters. |+| `--reason` | Who reviewed it and which trace events support it. |++## Kinds++- `workflow`: a procedure with a required order. "Build the hooks binary before+ `go test ./...` in cli/beacon."+- `correction`: the user corrected the agent, and the correction generalises. "Use+ `testenv.SetHome`, not `t.Setenv(\"HOME\")`: Windows ignores HOME."+- `debugging_pattern`: a symptom that points to a cause that is not obvious. "`pattern+ hooks.bin: no matching files` means the embedded hooks binary was never built."+- `gotcha`: a trap with no error message, or a misleading one. "Vector 0.57+ stops+ expanding `${VAR}` in the generated packs."+- `convention`: a project rule the trace shows, not a personal preference. "Every new+ collection path sets `harness.collection_method`."++## Good++```text+Title: Build the embedded hooks binary before running cli/beacon tests+Kind: workflow+Applicability: when running go test in cli/beacon on a fresh checkout+Tags: build, testing, cli++Run `make build-hooks-current` in cli/beacon before `go test ./...`.+The package embeds hooks.bin, and on a fresh checkout the build fails with+"pattern hooks.bin: no matching files found" (trace events 14-19).+Confirm with `go build ./...`, which should exit 0 before you run the tests.+```++## Not a memory++- A summary of what happened ("The agent fixed the flaky test"). Say what to do next time.+- A one-off fact ("PR 612 was merged on Tuesday").+- Anything true only on one machine, branch, or day.+- Speculation the trace does not show. If you cannot point to the events, do not write it.+- A restatement of the repository's own docs. Memory is for what the docs do not say.++## Before you present a draft++- Every claim traces to an event number you read.+- No secret, token, credential, hostname, customer name, or personal detail appears+ anywhere in the fields.+- It would still help an agent that has never seen this session.+- It does not duplicate an existing memory (check with `beacon memory list -q`).diff --git a/agent-skills/skills/beacon-memory-promote/SKILL.md b/agent-skills/skills/beacon-memory-promote/SKILL.mdnew file mode 100644index 00000000..0edd4e75--- /dev/null+++ b/agent-skills/skills/beacon-memory-promote/SKILL.md@@ -0,0 +1,94 @@+---+name: beacon-memory-promote+description: Install approved Beacon project memory as an Agent Skill in the repository (.agents/skills/<slug>/SKILL.md), so every skill-capable harness loads the lesson automatically without a memory lookup. Use when the user asks to "make this a skill", "promote", "install", or "share" an approved Beacon memory, or wants the team's agents to always follow a learned workflow or convention.+license: MIT+compatibility: Requires the Beacon CLI (beacon) on PATH. Local only. Writes files inside the current project.+metadata:+ author: asymptote-labs+ homepage: https://docs.asymptotelabs.ai/cli/memory+ version: "0.1.0"+---++# Beacon memory promote: memory to skill++Approved memory is recalled on demand. A **skill** is loaded by the harness itself+whenever its description matches the task, and when it is committed to the repository it+reaches every teammate and every harness that reads `.agents/skills` (Codex, Cursor,+Gemini CLI, GitHub Copilot, OpenCode, Amp, goose, and others; Claude Code reads+`.claude/skills`).++Promote only what earns that. Each installed skill adds to what every agent considers on+every task.++## What to promote++Good candidates:++- `workflow` and `convention` memories that apply to many tasks in this repository.+- A `debugging_pattern` for a failure that keeps recurring.++Leave in memory, where recall finds them when needed:++- One-off gotchas tied to a single file or incident.+- Anything that duplicates the repository's CLAUDE.md, AGENTS.md, or contributing docs.+ Suggest editing those docs instead.++## Step 1: choose the memory++```bash+beacon memory list --limit 25+beacon memory show <memory-id> --json+```++The skill commands take the **candidate** ID, which is the `candidate_id` field of the+memory.++## Step 2: preview++```bash+beacon memory skills preview <candidate-id>+```++Check the preview with the user:++- The `description` is the title plus the memory's applicability. It decides when a+ harness loads the skill, so it must name the trigger (a command, path, or error). If it+ is vague, the fix is a better memory: draft a sharper title and applicability, approve a+ replacement through the `beacon-memory-distill` workflow, and supersede the old one.+- The body must hold no secrets, hostnames, or personal details. It is about to become a+ file that is likely to be committed.++## Step 3: install, after the user confirms++```bash+beacon memory skills install <candidate-id>+```++This writes `.agents/skills/<slug>/SKILL.md` in the project (or the `--project` path). It+refuses to overwrite an existing file; pass `--force` only when the user wants to replace+the generated skill, and never over a file a person has edited by hand without asking.++For Claude Code, which reads `.claude/skills` rather than `.agents/skills`, offer to+link the skill there:++```bash+mkdir -p .claude/skills && ln -s ../../.agents/skills/<slug> .claude/skills/<slug>+```++## Step 4: hand off++Show the path and remind the user that:++- The file carries Beacon provenance under `metadata` (`beacon_memory_id`,+ `beacon_candidate_id`), so a reviewer can trace it back to the approved memory and the+ source session.+- It becomes team-wide only when they commit it. Do not commit or push unless they ask.+- If the memory is later superseded, the installed skill is not updated automatically.+ Re-run preview and install with `--force` from the replacement candidate.++## Boundaries++- Never install without the user seeing the preview and confirming.+- Never approve or edit memory here. Use `beacon-memory-distill`.+- Do not write to user-level skill directories (such as `~/.agents/skills`). Beacon memory+ is scoped to a project.diff --git a/agent-skills/skills/beacon-memory-recall/SKILL.md b/agent-skills/skills/beacon-memory-recall/SKILL.mdnew file mode 100644index 00000000..806a3c7d--- /dev/null+++ b/agent-skills/skills/beacon-memory-recall/SKILL.md@@ -0,0 +1,105 @@+---+name: beacon-memory-recall+description: Retrieve reviewed project memory that Beacon distilled from earlier agent sessions in any harness (Claude Code, Cursor, Codex, OpenCode, and others) before starting work. Use at the start of a non-trivial task in a repository, when the user asks "have we seen this before", "what did we learn last time", or "how did we fix this in Cursor/Codex", or when a build, test, or deploy step fails in a way that may have a known fix.+license: MIT+compatibility: Requires the Beacon CLI (beacon) on PATH with endpoint capture installed. Reads only local state and makes no network calls.+metadata:+ author: asymptote-labs+ homepage: https://docs.asymptotelabs.ai/concepts/cross-harness-memory+ version: "0.1.0"+---++# Beacon memory recall++Beacon records what agents do across every supported harness into a local log. Through+the `beacon-memory-distill` workflow, a person reviews selected sessions and approves the+reusable lessons into **project memory**. This skill reads that memory back, so you start+the task knowing what earlier agents, in this harness or any other, already learned about+this repository.++Approved memory has been reviewed by a person. Raw traces have not. Keep the two apart in+everything you say.++## When to recall++- Before planning a non-trivial change in a repository you have not worked in during this+ session.+- When a command fails in a way that could have a known fix (flaky tests, packaging,+ environment setup, release steps).+- When the user asks what was learned, tried, or decided before.++Skip it for trivial edits, and recall at most once per task unless the task changes+direction.++## Step 1: check that Beacon is available++```bash+beacon version+```++If `beacon` is not found, tell the user that project memory is unavailable because the+Beacon CLI is not installed, point them to https://docs.asymptotelabs.ai/get-started, and+continue the task without memory. Do not install it yourself.++## Step 2: retrieve memory++Prefer the Beacon MCP tools when this session has them. They are named `search_memory`,+`get_memory`, and `get_memory_context`, usually under a server called `beacon`.++1. Call `get_memory_context` with `task` set to a one-sentence description of the current+ task. It returns up to five relevant approved memories for the current project.+2. Call `get_memory` with an `id` from that result when you need the full body and its+ evidence.++Without the MCP tools, use the CLI from inside the repository:++```bash+# Up to five memories matching the task's key terms (every term must match)+beacon memory list --json --limit 5 -q "<two or three distinctive terms>"++# Everything approved for this project, newest first+beacon memory list --limit 25++# One memory in full, with its source traces+beacon memory show <memory-id>+```++Search terms are ANDed, so start with two or three distinctive words (a tool, a file, an+error string) and drop terms if nothing matches. `--kind` narrows to `workflow`,+`correction`, `debugging_pattern`, `gotcha`, or `convention`.++Memory is scoped to the project resolved from the current directory. Run from inside the+repository, or pass `--project <path>`.++## Step 3: use what you found++- Apply a memory only when its applicability matches the current situation. Memories are+ lessons from specific sessions, not project policy. If one conflicts with the user's+ instructions or the repository's own docs (CLAUDE.md, AGENTS.md, README), follow the+ user and the docs, and mention the conflict.+- When a memory changes what you do, say so in one line and cite its ID, for example:+ "Using Beacon memory `memory_4f2c…`: package smoke needs build-pkg.sh first."+- If nothing relevant comes back, carry on. Do not report an empty result unless the user+ asked.++## Raw history, only when asked++When the user explicitly asks what happened in an earlier session ("what did Cursor do+yesterday on the release script?"), you can search raw traces:++```bash+beacon endpoint traces search "<terms>" --json --limit 10+beacon endpoint traces show <trace-id> --json --limit 200+```++Present that as unreviewed history, never as approved memory. Traces can contain prompts,+command output, and file contents: quote only what the user needs, and never repeat+anything that looks like a credential. If the history holds a lesson worth keeping,+suggest the `beacon-memory-distill` workflow so a person can review it.++## Boundaries++- Read-only. Never approve, reject, or edit memory from this skill.+- Never run `beacon memory evaluations run` here. That step sends trace data to an+ evaluator over the network and belongs to `beacon-memory-distill`, where the user+ consents to it.diff --git a/cli/beacon/cmd/agent_skills_test.go b/cli/beacon/cmd/agent_skills_test.gonew file mode 100644index 00000000..f911bc85--- /dev/null+++ b/cli/beacon/cmd/agent_skills_test.go@@ -0,0 +1,276 @@+package cmd++import (+ "encoding/json"+ "os"+ "path/filepath"+ "regexp"+ "strings"+ "testing"++ "github.com/spf13/cobra"+)++// The publishable skills in agent-skills/ tell agents in other harnesses which+// beacon commands to run. They ship through marketplaces on their own schedule,+// so a renamed command or flag would break them silently. These tests keep them+// honest against the real command tree and the Agent Skills spec.++const agentSkillsDir = "../../../agent-skills"++var skillNamePattern = regexp.MustCompile(`^[a-z0-9]+(-[a-z0-9]+)*$`)++func agentSkillFiles(t *testing.T) []string {+ t.Helper()+ files, err := filepath.Glob(filepath.Join(agentSkillsDir, "skills", "*", "SKILL.md"))+ if err != nil {+ t.Fatal(err)+ }+ if len(files) == 0 {+ t.Fatalf("no skills found under %s", agentSkillsDir)+ }+ return files+}++func TestAgentSkillsFrontmatterFollowsSpec(t *testing.T) {+ for _, path := range agentSkillFiles(t) {+ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatal(err)+ }+ text := normalizeNewlines(data)+ if !strings.HasPrefix(text, "---\n") {+ t.Fatalf("%s: missing frontmatter", path)+ }+ frontmatter := strings.SplitN(text[4:], "\n---\n", 2)[0]+ fields := map[string]string{}+ for _, line := range strings.Split(frontmatter, "\n") {+ if line == "" || strings.HasPrefix(line, " ") {+ continue+ }+ key, value, _ := strings.Cut(line, ":")+ fields[key] = strings.TrimSpace(value)+ }+ for key := range fields {+ switch key {+ case "name", "description", "license", "compatibility", "metadata", "allowed-tools":+ default:+ t.Errorf("%s: frontmatter key %q is not in the Agent Skills spec", path, key)+ }+ }+ dir := filepath.Base(filepath.Dir(path))+ if name := fields["name"]; name != dir || len(name) > 64 || !skillNamePattern.MatchString(name) {+ t.Errorf("%s: name %q must match its directory %q and the spec pattern", path, name, dir)+ }+ if n := len([]rune(fields["description"])); n == 0 || n > 1024 {+ t.Errorf("%s: description is %d characters, want 1-1024", path, n)+ }+ if n := len([]rune(fields["compatibility"])); n > 500 {+ t.Errorf("%s: compatibility is %d characters, want at most 500", path, n)+ }+ if lines := strings.Count(text, "\n"); lines > 500 {+ t.Errorf("%s: %d lines; keep SKILL.md under 500 and move detail to references/", path, lines)+ }+ for _, link := range regexp.MustCompile(`\]\((references/[^)]+)\)`).FindAllStringSubmatch(text, -1) {+ if _, err := os.Stat(filepath.Join(filepath.Dir(path), link[1])); err != nil {+ t.Errorf("%s: linked file %s is missing", path, link[1])+ }+ }+ }+}++func TestAgentSkillsReferenceRealCommandsAndFlags(t *testing.T) {+ checked := 0+ for _, path := range append(agentSkillFiles(t), mustGlob(t, filepath.Join(agentSkillsDir, "skills", "*", "references", "*.md"))...) {+ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatal(err)+ }+ for _, command := range beaconCommandsInMarkdown(normalizeNewlines(data)) {+ checkBeaconCommand(t, path, command)+ checked+++ }+ }+ if checked < 10 {+ t.Fatalf("only %d beacon commands found in the skills; the extractor is probably broken", checked)+ }+}++func TestAgentSkillsManifestsAgree(t *testing.T) {+ type manifest struct {+ Name string `json:"name"`+ Version string `json:"version"`+ }+ read := func(rel string) manifest {+ t.Helper()+ data, err := os.ReadFile(filepath.Join(agentSkillsDir, rel))+ if err != nil {+ t.Fatal(err)+ }+ var m manifest+ if err := json.Unmarshal(data, &m); err != nil {+ t.Fatalf("%s: %v", rel, err)+ }+ return m+ }+ want := read("plugin.json")+ for _, rel := range []string{".claude-plugin/plugin.json", "gemini-extension.json"} {+ if got := read(rel); got != want {+ t.Errorf("%s = %+v, want %+v (same as plugin.json)", rel, got, want)+ }+ }+ data, err := os.ReadFile(filepath.Join(agentSkillsDir, "..", ".claude-plugin", "marketplace.json"))+ if err != nil {+ t.Fatal(err)+ }+ var marketplace struct {+ Plugins []struct {+ manifest+ Source string `json:"source"`+ } `json:"plugins"`+ }+ if err := json.Unmarshal(data, &marketplace); err != nil {+ t.Fatal(err)+ }+ found := false+ for _, p := range marketplace.Plugins {+ if p.Source == "./agent-skills" {+ found = true+ if p.manifest != want {+ t.Errorf("marketplace entry = %+v, want %+v", p.manifest, want)+ }+ }+ }+ if !found {+ t.Error("marketplace.json has no entry for ./agent-skills")+ }+ for _, path := range agentSkillFiles(t) {+ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatal(err)+ }+ if !strings.Contains(normalizeNewlines(data), `version: "`+want.Version+`"`) {+ t.Errorf("%s: metadata version should be %q like plugin.json", path, want.Version)+ }+ }+}++// normalizeNewlines undoes a CRLF checkout, which Windows runners may use.+func normalizeNewlines(data []byte) string {+ return strings.ReplaceAll(string(data), "\r\n", "\n")+}++func mustGlob(t *testing.T, pattern string) []string {+ t.Helper()+ files, err := filepath.Glob(pattern)+ if err != nil {+ t.Fatal(err)+ }+ return files+}++// beaconCommandsInMarkdown returns every beacon invocation in fenced code blocks+// and inline code spans, with line continuations joined and heredocs dropped.+func beaconCommandsInMarkdown(text string) []string {+ var out []string+ inFence := false+ var pending string+ for _, line := range strings.Split(text, "\n") {+ trimmed := strings.TrimSpace(line)+ if strings.HasPrefix(trimmed, "```") {+ inFence = !inFence+ pending = ""+ continue+ }+ if inFence {+ if pending != "" {+ trimmed = pending + " " + trimmed+ pending = ""+ }+ if strings.HasSuffix(trimmed, `\`) {+ pending = strings.TrimSuffix(trimmed, `\`)+ continue+ }+ if strings.HasPrefix(trimmed, "beacon ") {+ out = append(out, trimmed)+ }+ continue+ }+ for _, span := range regexp.MustCompile("`(beacon [^`]+)`").FindAllStringSubmatch(line, -1) {+ out = append(out, span[1])+ }+ }+ return out+}++func checkBeaconCommand(t *testing.T, path, command string) {+ t.Helper()+ if i := strings.Index(command, "<<"); i >= 0 {+ command = command[:i]+ }+ tokens := shellFields(command)[1:]+ var words []string+ for _, token := range tokens {+ if strings.HasPrefix(token, "-") {+ break+ }+ words = append(words, token)+ }+ cmd, rest, err := rootCmd.Find(words)+ if err != nil || cmd == rootCmd {+ t.Errorf("%s: %q does not name a beacon command", path, command)+ return+ }+ if cmd.HasSubCommands() && len(rest) > 0 && !strings.HasPrefix(rest[0], "<") && !strings.HasPrefix(rest[0], `"`) {+ t.Errorf("%s: %q: %q is not a subcommand of %q", path, command, rest[0], cmd.CommandPath())+ }+ for _, token := range tokens {+ if !strings.HasPrefix(token, "-") || token == "-" {+ continue+ }+ if !hasFlag(cmd, token) {+ t.Errorf("%s: %q: %s has no flag %s", path, command, cmd.CommandPath(), token)+ }+ }+}++func hasFlag(cmd *cobra.Command, token string) bool {+ name, _, _ := strings.Cut(token, "=")+ flags := cmd.Flags()+ if strings.HasPrefix(name, "--") {+ return flags.Lookup(name[2:]) != nil || cmd.InheritedFlags().Lookup(name[2:]) != nil || name == "--help"+ }+ short := strings.TrimPrefix(name, "-")+ return len(short) == 1 && (flags.ShorthandLookup(short) != nil || cmd.InheritedFlags().ShorthandLookup(short) != nil)+}++// shellFields splits on spaces outside single or double quotes. It is enough for+// the documented examples, which use no escapes or substitutions.+func shellFields(s string) []string {+ var fields []string+ var current strings.Builder+ var quote rune+ for _, r := range s {+ switch {+ case quote != 0:+ if r == quote {+ quote = 0+ }+ current.WriteRune(r)+ case r == '\'' || r == '"':+ quote = r+ current.WriteRune(r)+ case r == ' ' || r == '\t':+ if current.Len() > 0 {+ fields = append(fields, current.String())+ current.Reset()+ }+ default:+ current.WriteRune(r)+ }+ }+ if current.Len() > 0 {+ fields = append(fields, current.String())+ }+ return fields+}diff --git a/cli/beacon/cmd/memory.go b/cli/beacon/cmd/memory.goindex d7d008d2..48a7e82b 100644--- a/cli/beacon/cmd/memory.go+++ b/cli/beacon/cmd/memory.go@@ -4,6 +4,7 @@ import ("context""encoding/json""fmt"+ "io""os""strings""time"@@ -40,6 +41,11 @@ var memoryOpts struct {reason stringreplacement stringforce bool+ title string+ body string+ bodyFile string+ applies string+ tags []string}var memoryCmd = &cobra.Command{@@ -47,6 +53,21 @@ var memoryCmd = &cobra.Command{Short: "Evaluate and review cross-harness agent memory",}+var memoryListCmd = &cobra.Command{+ Use: "list",+ Short: "List approved project memory",+ SilenceUsage: true,+ RunE: runMemoryList,+}++var memoryShowCmd = &cobra.Command{+ Use: "show <memory-id>",+ Short: "Show one approved memory item",+ Args: cobra.ExactArgs(1),+ SilenceUsage: true,+ RunE: runMemoryShow,+}+var memoryEvaluationsCmd = &cobra.Command{Use: "evaluations",Short: "Run and inspect local trace evaluations",@@ -153,6 +174,8 @@ type evaluationRunResult struct {func init() {rootCmd.AddCommand(memoryCmd)+ memoryCmd.AddCommand(memoryListCmd)+ memoryCmd.AddCommand(memoryShowCmd)memoryCmd.AddCommand(memoryEvaluationsCmd)memoryCmd.AddCommand(memoryCandidatesCmd)memoryCmd.AddCommand(memorySkillsCmd)@@ -167,20 +190,27 @@ func init() {memorySkillsCmd.AddCommand(memorySkillsPreviewCmd)memorySkillsCmd.AddCommand(memorySkillsInstallCmd)- for _, c := range []*cobra.Command{memoryEvaluationsRunCmd, memoryEvaluationsListCmd, memoryEvaluationsShowCmd, memoryCandidatesListCmd, memoryCandidatesShowCmd, memoryCandidatesApproveCmd, memoryCandidatesRejectCmd, memoryCandidatesSupersedeCmd, memorySkillsPreviewCmd, memorySkillsInstallCmd} {+ for _, c := range []*cobra.Command{memoryListCmd, memoryShowCmd, memoryEvaluationsRunCmd, memoryEvaluationsListCmd, memoryEvaluationsShowCmd, memoryCandidatesListCmd, memoryCandidatesShowCmd, memoryCandidatesApproveCmd, memoryCandidatesRejectCmd, memoryCandidatesSupersedeCmd, memorySkillsPreviewCmd, memorySkillsInstallCmd} {c.Flags().BoolVar(&memoryOpts.userMode, "user", true, "Use per-user endpoint paths")c.Flags().BoolVar(&memoryOpts.systemMode, "system", false, "Use system endpoint paths")c.Flags().StringVar(&memoryOpts.logPath, "log-path", "", "Runtime JSONL log path")c.Flags().BoolVar(&memoryOpts.jsonOutput, "json", false, "Print machine-readable JSON")c.Flags().StringVar(&memoryOpts.projectPath, "project", "", "Project path for memory scoping (defaults to current directory)")}- for _, c := range []*cobra.Command{memoryEvaluationsRunCmd, memoryEvaluationsListCmd, memoryCandidatesListCmd} {+ for _, c := range []*cobra.Command{memoryListCmd, memoryEvaluationsRunCmd, memoryEvaluationsListCmd, memoryCandidatesListCmd} {c.Flags().IntVar(&memoryOpts.limit, "limit", 25, "Limit returned traces or evaluations")c.Flags().IntVar(&memoryOpts.page, "page", 1, "Page number for collection output")c.Flags().StringVarP(&memoryOpts.query, "query", "q", "", "Free-text query")}memoryCandidatesListCmd.Flags().StringVar(&memoryOpts.state, "state", "", "Filter candidates by state")memoryCandidatesListCmd.Flags().StringVar(&memoryOpts.kind, "kind", "", "Filter candidates by memory kind")+ memoryListCmd.Flags().StringVar(&memoryOpts.kind, "kind", "", "Filter approved memory by kind")+ memoryCandidatesApproveCmd.Flags().StringVar(&memoryOpts.title, "title", "", "Title for the approved memory (defaults to the candidate title)")+ memoryCandidatesApproveCmd.Flags().StringVar(&memoryOpts.body, "body", "", "Lesson text for the approved memory (defaults to the candidate body)")+ memoryCandidatesApproveCmd.Flags().StringVar(&memoryOpts.bodyFile, "body-file", "", "Read the lesson text from a file, or - for stdin")+ memoryCandidatesApproveCmd.Flags().StringVar(&memoryOpts.applies, "applicability", "", "When the memory applies, such as \"when package smoke fails on macOS\"")+ memoryCandidatesApproveCmd.Flags().StringVar(&memoryOpts.kind, "kind", "", "Memory kind: workflow, correction, debugging_pattern, gotcha, or convention")+ memoryCandidatesApproveCmd.Flags().StringSliceVar(&memoryOpts.tags, "tag", nil, "Tag for the approved memory; repeat or comma-separate (replaces the candidate tags)")for _, c := range []*cobra.Command{memoryCandidatesApproveCmd, memoryCandidatesRejectCmd, memoryCandidatesSupersedeCmd} {c.Flags().StringVar(&memoryOpts.reason, "reason", "", "Review reason recorded with the candidate")}@@ -198,6 +228,58 @@ func init() {memoryEvaluationsRunCmd.Flags().DurationVar(&memoryOpts.timeout, "timeout", 10*time.Second, "Jev request timeout")}+func runMemoryList(cmd *cobra.Command, args []string) error {+ query, err := memoryQuery()+ if err != nil {+ return err+ }+ query.Kind = memoryOpts.kind+ memories, err := memoryStore().ListMemories(query)+ if err != nil {+ return err+ }+ if memoryOpts.jsonOutput {+ if memories == nil {+ memories = []asymptoteobserve.LearningMemoryV1{}+ }+ return json.NewEncoder(cmd.OutOrStdout()).Encode(memories)+ }+ for _, memory := range memories {+ fmt.Fprintf(cmd.OutOrStdout(), "%s\t%s\t%s\n", memory.ID, memory.Kind, memory.Title)+ }+ return nil+}++func runMemoryShow(cmd *cobra.Command, args []string) error {+ memory, ok, err := memoryStore().GetMemory(args[0])+ if err != nil {+ return err+ }+ if !ok || memory.SupersededBy != "" {+ return fmt.Errorf("memory not found: %s", args[0])+ }+ if memoryOpts.jsonOutput {+ return json.NewEncoder(cmd.OutOrStdout()).Encode(memory)+ }+ fmt.Fprintf(cmd.OutOrStdout(), "%s\t%s\n", memory.ID, memory.Kind)+ fmt.Fprintln(cmd.OutOrStdout(), memory.Title)+ if memory.Applicability != "" {+ fmt.Fprintln(cmd.OutOrStdout(), "Applies "+memory.Applicability)+ }+ fmt.Fprintln(cmd.OutOrStdout())+ fmt.Fprintln(cmd.OutOrStdout(), memory.Body)+ for _, evidence := range memory.Evidence {+ fmt.Fprintf(cmd.OutOrStdout(), "\nTrace %s", evidence.TraceID)+ if evidence.Summary != "" {+ fmt.Fprintf(cmd.OutOrStdout(), ": %s", evidence.Summary)+ }+ }+ if len(memory.Evidence) > 0 {+ fmt.Fprintln(cmd.OutOrStdout())+ }+ return nil+}+func runMemoryEvaluationsRun(cmd *cobra.Command, args []string) error {project, err := learning.ResolveProject(memoryOpts.projectPath)if err != nil {@@ -340,7 +422,11 @@ func runMemoryCandidatesShow(cmd *cobra.Command, args []string) error {}func runMemoryCandidatesApprove(cmd *cobra.Command, args []string) error {- candidate, memory, err := learning.ApproveCandidate(memoryStore(), args[0], memoryOpts.reason)+ edits, err := memoryApprovalEdits(cmd)+ if err != nil {+ return err+ }+ candidate, memory, err := learning.ApproveCandidateWithEdits(memoryStore(), args[0], memoryOpts.reason, edits)if err != nil {return err}@@ -351,6 +437,36 @@ func runMemoryCandidatesApprove(cmd *cobra.Command, args []string) error {return nil}+// memoryApprovalEdits collects the reviewer-authored fields for an approval.+// --body and --body-file are exclusive so it is never ambiguous which text was+// approved.+func memoryApprovalEdits(cmd *cobra.Command) (learning.ApprovalEdits, error) {+ body := memoryOpts.body+ if memoryOpts.bodyFile != "" {+ if strings.TrimSpace(body) != "" {+ return learning.ApprovalEdits{}, fmt.Errorf("use --body or --body-file, not both")+ }+ var raw []byte+ var err error+ if memoryOpts.bodyFile == "-" {+ raw, err = io.ReadAll(cmd.InOrStdin())+ } else {+ raw, err = os.ReadFile(memoryOpts.bodyFile)+ }+ if err != nil {+ return learning.ApprovalEdits{}, fmt.Errorf("read --body-file: %w", err)+ }+ body = string(raw)+ }+ return learning.ApprovalEdits{+ Title: memoryOpts.title,+ Body: body,+ Applicability: memoryOpts.applies,+ Kind: memoryOpts.kind,+ Tags: memoryOpts.tags,+ }, nil+}+func runMemoryCandidatesReject(cmd *cobra.Command, args []string) error {candidate, err := learning.RejectCandidate(memoryStore(), args[0], memoryOpts.reason)if err != nil {diff --git a/cli/beacon/cmd/memory_test.go b/cli/beacon/cmd/memory_test.goindex df37ca67..ebfe658b 100644--- a/cli/beacon/cmd/memory_test.go+++ b/cli/beacon/cmd/memory_test.go@@ -21,6 +21,8 @@ import (func TestMemoryEvaluationCommandsRegistered(t *testing.T) {for _, path := range [][]string{+ {"memory", "list"},+ {"memory", "show"},{"memory", "evaluations", "run"},{"memory", "evaluations", "list"},{"memory", "evaluations", "show"},@@ -226,6 +228,84 @@ func TestMemoryCandidatesApproveCommand(t *testing.T) {}}+func TestMemoryApproveWithEditsThenListAndShow(t *testing.T) {+ logPath, project := writeMemoryCommandFixture(t)+ resetMemoryOpts(t)+ memoryOpts.userMode = true+ memoryOpts.logPath = logPath+ memoryOpts.projectPath = project+ candidate := testCommandCandidate(t)+ resolved, err := learning.ResolveProject(project)+ if err != nil {+ t.Fatal(err)+ }+ candidate.Project = resolved+ if err := memoryStore().PutCandidate(candidate); err != nil {+ t.Fatal(err)+ }+ bodyFile := filepath.Join(t.TempDir(), "lesson.md")+ if err := os.WriteFile(bodyFile, []byte("Rerun package smoke once when the failure is a launchctl timeout.\n"), 0644); err != nil {+ t.Fatal(err)+ }+ memoryOpts.title = "Package smoke launchctl timeouts are transient"+ memoryOpts.bodyFile = bodyFile+ memoryOpts.kind = asymptoteobserve.LearningMemoryKindGotcha+ memoryOpts.tags = []string{"packaging"}+ memoryOpts.jsonOutput = true+ var approveOut bytes.Buffer+ cmd := &cobra.Command{}+ cmd.SetOut(&approveOut)+ if err := runMemoryCandidatesApprove(cmd, []string{candidate.ID}); err != nil {+ t.Fatalf("runMemoryCandidatesApprove returned error: %v", err)+ }+ var approved struct {+ Memory asymptoteobserve.LearningMemoryV1 `json:"memory"`+ }+ if err := json.Unmarshal(approveOut.Bytes(), &approved); err != nil {+ t.Fatal(err)+ }+ if approved.Memory.Body != "Rerun package smoke once when the failure is a launchctl timeout." || approved.Memory.Kind != asymptoteobserve.LearningMemoryKindGotcha {+ t.Fatalf("approved memory = %#v", approved.Memory)+ }++ memoryOpts.kind = ""+ memoryOpts.query = "launchctl"+ var listOut bytes.Buffer+ cmd.SetOut(&listOut)+ if err := runMemoryList(cmd, nil); err != nil {+ t.Fatalf("runMemoryList returned error: %v", err)+ }+ var listed []asymptoteobserve.LearningMemoryV1+ if err := json.Unmarshal(listOut.Bytes(), &listed); err != nil {+ t.Fatal(err)+ }+ if len(listed) != 1 || listed[0].ID != approved.Memory.ID {+ t.Fatalf("listed = %#v", listed)+ }++ memoryOpts.jsonOutput = false+ var showOut bytes.Buffer+ cmd.SetOut(&showOut)+ if err := runMemoryShow(cmd, []string{approved.Memory.ID}); err != nil {+ t.Fatalf("runMemoryShow returned error: %v", err)+ }+ if !strings.Contains(showOut.String(), "launchctl timeout") || !strings.Contains(showOut.String(), "Trace trace-command") {+ t.Fatalf("show output = %s", showOut.String())+ }+ if err := runMemoryShow(cmd, []string{"memory_missing"}); err == nil {+ t.Fatal("showing an unknown memory should fail")+ }+}++func TestMemoryApproveRefusesBodyAndBodyFile(t *testing.T) {+ resetMemoryOpts(t)+ memoryOpts.body = "inline"+ memoryOpts.bodyFile = "-"+ if _, err := memoryApprovalEdits(&cobra.Command{}); err == nil {+ t.Fatal("--body with --body-file should be refused")+ }+}+func TestMemorySkillsPreviewAndInstallCommands(t *testing.T) {logPath, project := writeMemoryCommandFixture(t)resetMemoryOpts(t)@@ -329,6 +409,11 @@ func resetMemoryOpts(t *testing.T) {reason stringreplacement stringforce bool+ title string+ body string+ bodyFile string+ applies string+ tags []string}{userMode: true, limit: 25, page: 1, jevCost: learning.DefaultCostPerTrace}t.Cleanup(func() { memoryOpts = previous })}diff --git a/cli/beacon/internal/learning/candidate.go b/cli/beacon/internal/learning/candidate.goindex 62d8258f..3c5a04e6 100644--- a/cli/beacon/internal/learning/candidate.go+++ b/cli/beacon/internal/learning/candidate.go@@ -97,7 +97,42 @@ func CandidateFromEvaluation(eval asymptoteobserve.LearningEvaluationV1) (asymptreturn candidate, true}+// ApprovalEdits carries reviewer-authored text that replaces the candidate's+// fields in the approved memory. The evaluator scores traces but does not write+// lessons, so a reviewer (or an agent the reviewer is working with) supplies the+// title, body, and applicability after reading the source trace. Empty fields+// keep the candidate's value. The candidate record itself is left as the+// evaluator produced it, so the review history shows what was changed.+type ApprovalEdits struct {+ Title string+ Body string+ Applicability string+ Kind string+ Tags []string+}++// ValidMemoryKind reports whether kind is one of the memory kinds Beacon defines.+func ValidMemoryKind(kind string) bool {+ switch kind {+ case asymptoteobserve.LearningMemoryKindWorkflow,+ asymptoteobserve.LearningMemoryKindCorrection,+ asymptoteobserve.LearningMemoryKindDebuggingPattern,+ asymptoteobserve.LearningMemoryKindGotcha,+ asymptoteobserve.LearningMemoryKindConvention:+ return true+ }+ return false+}+func ApproveCandidate(store *Store, id, reason string) (asymptoteobserve.LearningCandidateV1, asymptoteobserve.LearningMemoryV1, error) {+ return ApproveCandidateWithEdits(store, id, reason, ApprovalEdits{})+}++func ApproveCandidateWithEdits(store *Store, id, reason string, edits ApprovalEdits) (asymptoteobserve.LearningCandidateV1, asymptoteobserve.LearningMemoryV1, error) {+ kind := strings.TrimSpace(edits.Kind)+ if kind != "" && !ValidMemoryKind(kind) {+ return asymptoteobserve.LearningCandidateV1{}, asymptoteobserve.LearningMemoryV1{}, fmt.Errorf("unknown memory kind %q (want workflow, correction, debugging_pattern, gotcha, or convention)", kind)+ }candidate, ok, err := store.GetCandidate(id)if err != nil {return asymptoteobserve.LearningCandidateV1{}, asymptoteobserve.LearningMemoryV1{}, err@@ -112,11 +147,11 @@ func ApproveCandidate(store *Store, id, reason string) (asymptoteobserve.Learninmemory := asymptoteobserve.LearningMemoryV1{SchemaVersion: asymptoteobserve.LearningSchemaVersion,CandidateID: candidate.ID,- Kind: candidate.Kind,- Title: candidate.Title,- Body: candidate.Body,- Applicability: candidate.Applicability,- Tags: append([]string(nil), candidate.Tags...),+ Kind: firstNonEmpty(kind, candidate.Kind),+ Title: firstNonEmpty(edits.Title, candidate.Title),+ Body: firstNonEmpty(edits.Body, candidate.Body),+ Applicability: firstNonEmpty(edits.Applicability, candidate.Applicability),+ Tags: approvedTags(edits.Tags, candidate.Tags),Project: candidate.Project,Evidence: append([]asymptoteobserve.LearningEvidenceV1(nil), candidate.Evidence...),CreatedAt: now,@@ -136,6 +171,25 @@ func ApproveCandidate(store *Store, id, reason string) (asymptoteobserve.Learninreturn candidate, memory, nil}+// approvedTags uses the reviewer's tags when any were given, trimmed and without+// empties or duplicates, and otherwise the candidate's.+func approvedTags(edited, original []string) []string {+ var out []string+ seen := map[string]bool{}+ for _, tag := range edited {+ tag = strings.TrimSpace(tag)+ if tag == "" || seen[tag] {+ continue+ }+ seen[tag] = true+ out = append(out, tag)+ }+ if len(out) > 0 {+ return out+ }+ return append([]string(nil), original...)+}+func RejectCandidate(store *Store, id, reason string) (asymptoteobserve.LearningCandidateV1, error) {candidate, ok, err := store.GetCandidate(id)if err != nil {diff --git a/cli/beacon/internal/learning/candidate_test.go b/cli/beacon/internal/learning/candidate_test.goindex 78215d22..05b9ae34 100644--- a/cli/beacon/internal/learning/candidate_test.go+++ b/cli/beacon/internal/learning/candidate_test.go@@ -101,3 +101,48 @@ func testLearningEvaluationWithID(evalID, traceID string) asymptoteobserve.Learn},}}++// The evaluator scores traces but writes no lesson, so approval must carry the+// reviewer's text into the memory while leaving the candidate as it was scored.+func TestApproveCandidateWithEditsUsesReviewerText(t *testing.T) {+ store := Open(filepath.Join(t.TempDir(), "memory.db"))+ candidate, ok := CandidateFromEvaluation(testLearningEvaluation())+ if !ok {+ t.Fatal("candidate not created")+ }+ if err := store.PutCandidate(candidate); err != nil {+ t.Fatal(err)+ }+ if _, _, err := ApproveCandidateWithEdits(store, candidate.ID, "", ApprovalEdits{Kind: "lesson"}); err == nil {+ t.Fatal("an unknown kind should be refused")+ }+ approved, memory, err := ApproveCandidateWithEdits(store, candidate.ID, "reviewed", ApprovalEdits{+ Title: "Run package smoke after build-pkg",+ Body: " Build the package before running smoke-endpoint.sh.\n",+ Applicability: "when editing packaging/macos",+ Kind: asymptoteobserve.LearningMemoryKindWorkflow,+ Tags: []string{"packaging", " ", "packaging", "macos"},+ })+ if err != nil {+ t.Fatalf("ApproveCandidateWithEdits: %v", err)+ }+ if memory.Title != "Run package smoke after build-pkg" || memory.Body != "Build the package before running smoke-endpoint.sh." {+ t.Fatalf("memory text = %q / %q", memory.Title, memory.Body)+ }+ if memory.Applicability != "when editing packaging/macos" || memory.Kind != asymptoteobserve.LearningMemoryKindWorkflow {+ t.Fatalf("memory = %#v", memory)+ }+ if len(memory.Tags) != 2 || memory.Tags[0] != "packaging" || memory.Tags[1] != "macos" {+ t.Fatalf("tags = %#v", memory.Tags)+ }+ if len(memory.Evidence) != 1 || memory.Evidence[0].TraceID != candidate.Evidence[0].TraceID {+ t.Fatalf("evidence = %#v", memory.Evidence)+ }+ stored, ok, err := store.GetCandidate(candidate.ID)+ if err != nil || !ok {+ t.Fatalf("GetCandidate: %v %v", ok, err)+ }+ if stored.Title != candidate.Title || stored.Body != candidate.Body || stored.MemoryID != approved.MemoryID {+ t.Fatalf("candidate should keep the evaluator's text: %#v", stored)+ }+}diff --git a/cli/beacon/internal/learning/skills.go b/cli/beacon/internal/learning/skills.goindex 01307aba..1ccbe8cb 100644--- a/cli/beacon/internal/learning/skills.go+++ b/cli/beacon/internal/learning/skills.go@@ -41,16 +41,20 @@ func CandidateMemoryForSkill(store *Store, candidateID string) (asymptoteobservefunc RenderSkill(candidate asymptoteobserve.LearningCandidateV1, memory asymptoteobserve.LearningMemoryV1) string {slug := SkillSlug(memory)var b strings.Builder+ // Provenance lives under metadata, the Agent Skills spec's string map for+ // client-specific keys, so a generated skill validates and can be published+ // like any other.b.WriteString("---\n")b.WriteString("name: " + slug + "\n")- b.WriteString("description: " + yamlQuote(firstSentence(memory.Title)) + "\n")- b.WriteString("beacon_memory_id: " + yamlQuote(memory.ID) + "\n")- b.WriteString("beacon_candidate_id: " + yamlQuote(candidate.ID) + "\n")+ b.WriteString("description: " + yamlQuote(skillDescription(memory)) + "\n")+ b.WriteString("metadata:\n")+ b.WriteString(" beacon_memory_id: " + yamlQuote(memory.ID) + "\n")+ b.WriteString(" beacon_candidate_id: " + yamlQuote(candidate.ID) + "\n")+ if memory.Kind != "" {+ b.WriteString(" beacon_memory_kind: " + yamlQuote(memory.Kind) + "\n")+ }if len(memory.Tags) > 0 {- b.WriteString("tags:\n")- for _, tag := range memory.Tags {- b.WriteString(" - " + yamlQuote(tag) + "\n")- }+ b.WriteString(" beacon_tags: " + yamlQuote(strings.Join(memory.Tags, ", ")) + "\n")}b.WriteString("---\n\n")b.WriteString("# " + memory.Title + "\n\n")@@ -106,6 +110,7 @@ func SkillSlug(memory asymptoteobserve.LearningMemoryV1) string {}var out strings.BuilderlastDash := false+runes:for _, r := range strings.ToLower(base) {switch {case unicode.IsLetter(r) || unicode.IsDigit(r):@@ -115,8 +120,10 @@ func SkillSlug(memory asymptoteobserve.LearningMemoryV1) string {out.WriteByte('-')lastDash = true}+ // Stop at 48 bytes so the name, with the beacon- prefix, stays within the+ // Agent Skills limit of 64 characters.if out.Len() >= 48 {- break+ break runes}}slug := strings.Trim(out.String(), "-")@@ -129,6 +136,23 @@ func SkillSlug(memory asymptoteobserve.LearningMemoryV1) string {return slug}+// maxSkillDescription is the Agent Skills limit on the description field.+const maxSkillDescription = 1024++// skillDescription is what a harness reads to decide when to load the skill, so+// it names the situation as well as the lesson: the title's first sentence, then+// the memory's applicability as a "Use ..." clause.+func skillDescription(memory asymptoteobserve.LearningMemoryV1) string {+ description := ensureTrailingPeriod(firstSentence(memory.Title))+ if applies := strings.Join(strings.Fields(memory.Applicability), " "); applies != "" {+ description += " Use " + ensureTrailingPeriod(applies)+ }+ if runes := []rune(description); len(runes) > maxSkillDescription {+ description = strings.TrimSpace(string(runes[:maxSkillDescription-1])) + "…"+ }+ return description+}+func yamlQuote(value string) string {escaped := strings.ReplaceAll(value, `\`, `\\`)escaped = strings.ReplaceAll(escaped, `"`, `\"`)diff --git a/cli/beacon/internal/learning/skills_test.go b/cli/beacon/internal/learning/skills_test.goindex 4f2e4679..151a71a8 100644--- a/cli/beacon/internal/learning/skills_test.go+++ b/cli/beacon/internal/learning/skills_test.go@@ -25,6 +25,46 @@ func TestRenderSkillIncludesProvenance(t *testing.T) {}}+// A generated skill must pass the Agent Skills spec so it can be published: the+// name fits in 64 characters, and provenance sits under metadata rather than as+// top-level keys the spec does not define.+func TestRenderSkillFollowsAgentSkillsSpec(t *testing.T) {+ candidate, memory := testApprovedSkillMemory()+ memory.Title = strings.Repeat("Always rebuild the embedded hooks binary before running tests ", 3)+ memory.Applicability = "when cli/beacon tests fail\nagainst the placeholder"+ content := RenderSkill(candidate, memory)+ frontmatter := strings.SplitN(strings.TrimPrefix(content, "---\n"), "\n---\n", 2)[0]+ var name, description string+ for _, line := range strings.Split(frontmatter, "\n") {+ if !strings.HasPrefix(line, " ") && strings.Contains(line, ":") {+ key := strings.SplitN(line, ":", 2)[0]+ switch key {+ case "name":+ name = strings.TrimSpace(strings.TrimPrefix(line, "name:"))+ case "description":+ description = strings.TrimSpace(strings.TrimPrefix(line, "description:"))+ case "metadata":+ default:+ t.Fatalf("top-level frontmatter key %q is not in the Agent Skills spec:\n%s", key, frontmatter)+ }+ }+ }+ if len(name) == 0 || len(name) > 64 || strings.Contains(name, "--") || strings.HasSuffix(name, "-") {+ t.Fatalf("name %q does not meet the spec", name)+ }+ if name != SkillSlug(memory) {+ t.Fatalf("name %q != slug %q", name, SkillSlug(memory))+ }+ if !strings.Contains(description, "Use when cli/beacon tests fail against the placeholder.") {+ t.Fatalf("description should carry the applicability on one line: %s", description)+ }+ for _, want := range []string{` beacon_memory_kind: "debugging_pattern"`, ` beacon_tags: "beacon, debugging_pattern"`} {+ if !strings.Contains(frontmatter, want) {+ t.Fatalf("frontmatter missing %q:\n%s", want, frontmatter)+ }+ }+}+func TestInstallSkillWritesAndRefusesOverwrite(t *testing.T) {project := t.TempDir()candidate, memory := testApprovedSkillMemory()diff --git a/docs/cli/memory.mdx b/docs/cli/memory.mdxindex 6ea1084c..94d5b247 100644--- a/docs/cli/memory.mdx+++ b/docs/cli/memory.mdx@@ -10,6 +10,7 @@ approved project memory.The commands are grouped by resource:+- `beacon memory list|show` for approved memory- `beacon memory evaluations run|list|show`- `beacon memory candidates list|show|approve|reject|supersede`- `beacon memory skills preview|install`@@ -106,7 +107,7 @@ beacon memory candidates listFilter candidate review queues:```bash-beacon memory candidates list --state pending --kind workflow+beacon memory candidates list --state candidate --kind workflowbeacon memory candidates list -q "package smoke"```@@ -121,12 +122,41 @@ body therefore says that no lesson text was extracted; check the source tracebefore you approve it. A compatible internal evaluator using the legacy`questions` or `results` response shape can provide a stored `reason`.+Candidate states are `candidate` (awaiting review), `approved`, `rejected`, and+`superseded`.+Approve a candidate into project memory:```bashbeacon memory candidates approve <candidate-id> --reason "reviewed"```+Because the evaluator scores traces without writing a lesson, approve with the lesson+you wrote after reading the source trace. The reviewed fields go into the approved+memory; the candidate keeps the evaluator's text so the review history shows what+changed:++```bash+beacon memory candidates approve <candidate-id> \+ --title "Build the embedded hooks binary before running cli/beacon tests" \+ --kind workflow \+ --applicability "when running go test in cli/beacon on a fresh checkout" \+ --tag build --tag testing \+ --reason "reviewed against trace events 14-19" \+ --body-file lesson.md+```++| Flag | Description |+|------|-------------|+| `--title <text>` | Title for the approved memory |+| `--body <text>` | Lesson text |+| `--body-file <path>` | Read the lesson text from a file, or `-` for stdin. Cannot be combined with `--body` |+| `--applicability <text>` | When the memory applies |+| `--kind <kind>` | `workflow`, `correction`, `debugging_pattern`, `gotcha`, or `convention` |+| `--tag <tag>` | Repeat or comma-separate. Replaces the candidate's tags |++Each flag left out keeps the candidate's value.+Reject or supersede candidates:```bash@@ -138,6 +168,20 @@ Approving creates an approved memory record for the resolved project. Rejectingsuperseding preserve the review transition with the optional `--reason` so laterreviews can explain why a candidate was not installed.+## Read approved memory++List and read approved memory for the resolved project. These are the same records the+MCP memory tools return, for harnesses and scripts without MCP:++```bash+beacon memory list+beacon memory list -q "package smoke" --kind workflow --json+beacon memory show <memory-id>+```++`-q` matches every term against the memory ID, title, body, and kind. Superseded memory+is not listed.+## Install Agent SkillsPreview the skill content without writing:@@ -160,8 +204,12 @@ Beacon writes:Existing files are not overwritten unless you pass `--force`.-Skill files include Beacon provenance so future reviewers can trace the generated-instruction back to the approved memory and source trace. Installation is a write+Skill files include Beacon provenance under the frontmatter `metadata` map+(`beacon_memory_id`, `beacon_candidate_id`, `beacon_memory_kind`, and `beacon_tags`), so+future reviewers can trace the generated instruction back to the approved memory and+source trace, and the file still validates against the Agent Skills specification. The+skill description combines the memory's title and applicability, because harnesses use+it to decide when to load the skill. Installation is a writeto the current project or the path passed with `--project`; it is never triggeredby endpoint hooks or MCP reads.diff --git a/docs/concepts/cross-harness-memory.mdx b/docs/concepts/cross-harness-memory.mdxindex 5961e352..03f6f54e 100644--- a/docs/concepts/cross-harness-memory.mdx+++ b/docs/concepts/cross-harness-memory.mdx@@ -83,10 +83,41 @@ Beacon exposes approved memory in two local ways:- `beacon memory skills preview|install` renders an approved candidate as an AgentSkill with Beacon provenance in the frontmatter.+`beacon memory list|show` reads the same approved records from the CLI.+This is what makes the memory portable across harnesses: one agent's reviewed tracecan become project knowledge that another MCP-capable or skill-capable agent canretrieve later.+## Beacon memory skills++The workflow itself ships as installable Agent Skills, so an agent in any harness can+drive it:++- `beacon-memory-recall` retrieves approved memory before a task.+- `beacon-memory-distill` runs the loop above. It dry-runs first, asks before the+ evaluation call, drafts each lesson from the source trace, and approves only what the+ user confirms.+- `beacon-memory-promote` installs approved memory as a project skill.++Install them with the harness's plugin marketplace, or with the skills CLI for any+skills-capable agent:++```bash+# Claude Code+/plugin marketplace add asymptote-labs/agent-beacon+/plugin install beacon@beacon++# Codex, GitHub Copilot CLI, and Factory Droid read the same marketplace+codex plugin marketplace add asymptote-labs/agent-beacon++# Cursor, OpenCode, Amp, goose, Cline, and others+npx skills add asymptote-labs/agent-beacon+```++The skills live in `agent-skills/` in the Beacon repository. See its README for the full+install and publishing matrix.+## Privacy boundary- Hooks never call Jev.