From 1a3e72eea65e039a2f1fdc2d6d42657269f74fec Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Fri, 5 Jun 2026 00:11:11 -0700 Subject: [PATCH] docs: rename workspace agents template --- docs/docs.json | 8 ++++++-- docs/reference/AGENTS.default.md | 2 +- docs/reference/templates/AGENTS.dev.md | 2 +- docs/reference/templates/CLAUDE.md | 1 - .../templates/{AGENTS.md => agents-template.md} | 0 docs/start/docs-directory.md | 2 +- docs/start/hubs.md | 2 +- scripts/lib/workspace-bootstrap-smoke.mjs | 2 +- src/agents/workspace.test.ts | 13 +++++++++++++ src/agents/workspace.ts | 6 +++++- 10 files changed, 29 insertions(+), 9 deletions(-) delete mode 120000 docs/reference/templates/CLAUDE.md rename docs/reference/templates/{AGENTS.md => agents-template.md} (100%) diff --git a/docs/docs.json b/docs/docs.json index 221fc23f2f7b..287521f6e5c1 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -786,7 +786,11 @@ }, { "source": "/templates/AGENTS", - "destination": "/reference/templates/AGENTS" + "destination": "/reference/templates/agents-template" + }, + { + "source": "/reference/templates/AGENTS", + "destination": "/reference/templates/agents-template" }, { "source": "/templates/BOOT", @@ -1792,7 +1796,7 @@ "group": "Templates", "pages": [ "reference/AGENTS.default", - "reference/templates/AGENTS", + "reference/templates/agents-template", "reference/templates/BOOT", "reference/templates/BOOTSTRAP", "reference/templates/HEARTBEAT", diff --git a/docs/reference/AGENTS.default.md b/docs/reference/AGENTS.default.md index 4550ee3cc302..5f7e1a6c684f 100644 --- a/docs/reference/AGENTS.default.md +++ b/docs/reference/AGENTS.default.md @@ -19,7 +19,7 @@ mkdir -p ~/.openclaw/workspace 2. Copy the default workspace templates into the workspace: ```bash -cp docs/reference/templates/AGENTS.md ~/.openclaw/workspace/AGENTS.md +cp docs/reference/templates/agents-template.md ~/.openclaw/workspace/AGENTS.md cp docs/reference/templates/SOUL.md ~/.openclaw/workspace/SOUL.md cp docs/reference/templates/TOOLS.md ~/.openclaw/workspace/TOOLS.md ``` diff --git a/docs/reference/templates/AGENTS.dev.md b/docs/reference/templates/AGENTS.dev.md index b7f33b717d1e..13980a7a48c5 100644 --- a/docs/reference/templates/AGENTS.dev.md +++ b/docs/reference/templates/AGENTS.dev.md @@ -86,5 +86,5 @@ We shook hand-to-claw that day. I shall never forget it. ## Related -- [AGENTS.md template](/reference/templates/AGENTS) +- [AGENTS.md template](/reference/templates/agents-template) - [Default AGENTS.md](/reference/AGENTS.default) diff --git a/docs/reference/templates/CLAUDE.md b/docs/reference/templates/CLAUDE.md deleted file mode 120000 index 47dc3e3d863c..000000000000 --- a/docs/reference/templates/CLAUDE.md +++ /dev/null @@ -1 +0,0 @@ -AGENTS.md \ No newline at end of file diff --git a/docs/reference/templates/AGENTS.md b/docs/reference/templates/agents-template.md similarity index 100% rename from docs/reference/templates/AGENTS.md rename to docs/reference/templates/agents-template.md diff --git a/docs/start/docs-directory.md b/docs/start/docs-directory.md index 328d6fef86e5..9f80604f0f39 100644 --- a/docs/start/docs-directory.md +++ b/docs/start/docs-directory.md @@ -24,7 +24,7 @@ For a complete map of the docs, see [Docs hubs](/start/hubs). - [OpenClaw assistant setup](/start/openclaw) - [Skills](/tools/skills) - [Skills config](/tools/skills-config) -- [Workspace templates](/reference/templates/AGENTS) +- [Workspace templates](/reference/templates/agents-template) - [RPC adapters](/reference/rpc) - [Gateway runbook](/gateway) - [Nodes (iOS and Android)](/nodes) diff --git a/docs/start/hubs.md b/docs/start/hubs.md index fe4e5bd0b883..8888f3ee7eda 100644 --- a/docs/start/hubs.md +++ b/docs/start/hubs.md @@ -178,7 +178,7 @@ Use these hubs to discover every page, including deep dives and reference docs t - [ClawHub](/clawhub) - [Skills config](/tools/skills-config) - [Default AGENTS](/reference/AGENTS.default) -- [Templates: AGENTS](/reference/templates/AGENTS) +- [Templates: AGENTS](/reference/templates/agents-template) - [Templates: BOOTSTRAP](/reference/templates/BOOTSTRAP) - [Templates: HEARTBEAT](/reference/templates/HEARTBEAT) - [Templates: IDENTITY](/reference/templates/IDENTITY) diff --git a/scripts/lib/workspace-bootstrap-smoke.mjs b/scripts/lib/workspace-bootstrap-smoke.mjs index 24c8fbf74928..c0d8242ee7bf 100644 --- a/scripts/lib/workspace-bootstrap-smoke.mjs +++ b/scripts/lib/workspace-bootstrap-smoke.mjs @@ -8,7 +8,7 @@ import { dirname, join } from "node:path"; * Template pack files that must be present in installed packages. */ export const WORKSPACE_TEMPLATE_PACK_PATHS = [ - "docs/reference/templates/AGENTS.md", + "docs/reference/templates/agents-template.md", "docs/reference/templates/SOUL.md", "docs/reference/templates/TOOLS.md", "docs/reference/templates/IDENTITY.md", diff --git a/src/agents/workspace.test.ts b/src/agents/workspace.test.ts index 127c2c284a45..2d09197f5f47 100644 --- a/src/agents/workspace.test.ts +++ b/src/agents/workspace.test.ts @@ -155,6 +155,19 @@ describe("ensureAgentWorkspace", () => { await expectPathMissing(path.join(tempDir, ...WORKSPACE_STATE_PATH_SEGMENTS)); }); + it("seeds workspace AGENTS.md from the non-instruction template source", async () => { + const tempDir = await makeTempWorkspace("openclaw-workspace-"); + + await ensureAgentWorkspace({ dir: tempDir, ensureBootstrapFiles: true }); + + const agents = await fs.readFile(path.join(tempDir, DEFAULT_AGENTS_FILENAME), "utf-8"); + const template = await fs.readFile( + path.join("docs", "reference", "templates", "agents-template.md"), + "utf-8", + ); + expect(agents).toBe(template.replace(/^---[\s\S]*?\n---\s*/, "")); + }); + it("refuses to re-seed a recently attested workspace after only generated remnants survive", async () => { const tempDir = await makeTempWorkspace("openclaw-workspace-"); await ensureAgentWorkspace({ dir: tempDir, ensureBootstrapFiles: true }); diff --git a/src/agents/workspace.ts b/src/agents/workspace.ts index 3517b4df8ec2..800160f9e18d 100644 --- a/src/agents/workspace.ts +++ b/src/agents/workspace.ts @@ -49,6 +49,9 @@ const WORKSPACE_ONBOARDING_PROFILE_FILENAMES = [ DEFAULT_IDENTITY_FILENAME, DEFAULT_USER_FILENAME, ] as const; +const WORKSPACE_TEMPLATE_SOURCE_FILENAMES: ReadonlyMap = new Map([ + [DEFAULT_AGENTS_FILENAME, "agents-template.md"], +]); const workspaceTemplateCache = new Map>(); let gitAvailabilityPromise: Promise | null = null; @@ -128,8 +131,9 @@ async function loadTemplate(name: string): Promise { ? [await resolveWorkspaceTemplateDir()] : await resolveWorkspaceTemplateSearchDirs(); const triedPaths: string[] = []; + const templateSourceName = WORKSPACE_TEMPLATE_SOURCE_FILENAMES.get(name) ?? name; for (const templateDir of templateDirs) { - const templatePath = path.join(templateDir, name); + const templatePath = path.join(templateDir, templateSourceName); triedPaths.push(templatePath); try { const content = await fs.readFile(templatePath, "utf-8");