From 26ced7b789556235b69e1f209ac82fad35c92b80 Mon Sep 17 00:00:00 2001 From: Ryan Vogel Date: Mon, 26 Jan 2026 20:48:55 -0500 Subject: [PATCH] core: move /learn command from built-in to .opencode/command/ --- .../template/learn.txt => .opencode/command/learn.md | 10 +++++++--- packages/opencode/src/command/index.ts | 11 ----------- 2 files changed, 7 insertions(+), 14 deletions(-) rename packages/opencode/src/command/template/learn.txt => .opencode/command/learn.md (84%) diff --git a/packages/opencode/src/command/template/learn.txt b/.opencode/command/learn.md similarity index 84% rename from packages/opencode/src/command/template/learn.txt rename to .opencode/command/learn.md index 7884be9803..fe4965a588 100644 --- a/packages/opencode/src/command/template/learn.txt +++ b/.opencode/command/learn.md @@ -1,10 +1,14 @@ +--- +description: Extract non-obvious learnings from session to AGENTS.md files to build codebase understanding +--- + Analyze this session and extract non-obvious learnings to add to AGENTS.md files. AGENTS.md files can exist at any directory level, not just the project root. When an agent reads a file, any AGENTS.md in parent directories are automatically loaded into the context of the tool read. Place learnings as close to the relevant code as possible: -- Project-wide learnings → ${path}/AGENTS.md -- Package/module-specific → ${path}/packages/foo/AGENTS.md -- Feature-specific → ${path}/src/auth/AGENTS.md +- Project-wide learnings → root AGENTS.md +- Package/module-specific → packages/foo/AGENTS.md +- Feature-specific → src/auth/AGENTS.md What counts as a learning (non-obvious discoveries only): diff --git a/packages/opencode/src/command/index.ts b/packages/opencode/src/command/index.ts index c9262991b3..976f1cd51e 100644 --- a/packages/opencode/src/command/index.ts +++ b/packages/opencode/src/command/index.ts @@ -4,7 +4,6 @@ import { Config } from "../config/config" import { Instance } from "../project/instance" import { Identifier } from "../id/id" import PROMPT_INITIALIZE from "./template/initialize.txt" -import PROMPT_LEARN from "./template/learn.txt" import PROMPT_REVIEW from "./template/review.txt" import { MCP } from "../mcp" @@ -54,7 +53,6 @@ export namespace Command { export const Default = { INIT: "init", REVIEW: "review", - LEARN: "learn", } as const const state = Instance.state(async () => { @@ -78,15 +76,6 @@ export namespace Command { subtask: true, hints: hints(PROMPT_REVIEW), }, - [Default.LEARN]: { - name: Default.LEARN, - description: "create/update scoped AGENTS.md files after a session", - get template() { - return PROMPT_LEARN.replace("${path}", Instance.worktree) - }, - subtask: true, - hints: hints(PROMPT_LEARN), - }, } for (const [name, command] of Object.entries(cfg.command ?? {})) {