An undeclared file stays out of an OpenClaw template

John Burns

The new workspace had three files. SOUL.md was the body of CLAW.md, and the front matter was not in it. AGENTS.md was the one sentence declared as a bootstrap file. skills/checklist/SKILL.md was the bundled skill. A fourth file, secret.env, sat in the project root with a marker that is not a credential. It was not declared. It was not in the workspace, and the marker was not anywhere under the new home.

That split is the check. The release note for 2 December 2026 says a Template carries instructions, skills, plugins, and schedules, and leaves chats, memory, and credentials behind. The note does not show the file list a local add actually writes. This run did.

The binary and the two files create writes

The package was OpenClaw 2026.12.1, build 6a27c35, installed from the npm registry into an isolated prefix on 2 December 2026. The process was started with Node v24.22.3 from the official Linux x86_64 tarball. That archive’s SHA-256 matched 4f2b175a6d53a5c617a80dba2676238a0688cef28c6da4eba35c7d844e66fcfb in SHASUMS256.txt before it was unpacked. The host’s other Node binary was not on the PATH used for these commands. No gateway service was installed. No channel account was added. No model login was attempted. HOME pointed at a new directory. The account home had no OpenClaw state directory before the first command and none after the last one.

templates create on an empty directory exited 0. The JSON said ok true and filesWritten was package.json and CLAW.md. Nothing else. The package name was the string passed to --name. The version was 0.1.0, not a version I supplied. openclaw.template was CLAW.md. The generated manifest set schemaVersion to 1, quoted the agent id and the display name, and used a one-line body: the agent was a purpose-built OpenClaw agent. That file was replaced before any validate or add. The replacement is what the later commands read. Create’s own body was not the text that became SOUL.md.

The replacement kept schemaVersion 1, set the agent id and name without quotes, declared workspace/AGENTS.md as the bootstrap source for AGENTS.md, and declared one skill at skills/checklist. Plugins, MCP servers, and automations were empty. The Markdown body was a heading and two sentences: review one incident title and stop, and do not send messages. The skill file had its own front matter, a name, a one-line description, and one instruction. AGENTS.md was one sentence telling the agent to follow the checklist and not call the pager. secret.env was a sibling of CLAW.md, not a path in the manifest.

Excluded means not packaged

templates validate --json on that tree exited 0. ok was true. diagnostics was an empty list. excludedPaths had one entry, secret.env. The manifest in the same object named the bootstrap file and the skill path, and it did not name the marker file. Validation is not a silent copy. It is a report of which paths the package will keep.

templates dev --json exited 0 and said offline true and mutationAllowed false. Its build file list was CLAW.md, package.json, skills/checklist/SKILL.md, and workspace/AGENTS.md. excludedPaths was again secret.env. The plan under that object was a dry run. It named five actions: create the agent, create the workspace, write SOUL.md from the template Markdown body, write AGENTS.md from the declared source, and install the bundled skill. secret.env was not an action. The planned workspace was under the state directory, named from the agent id. That directory was not created. Dev did not mutate the home.

templates build wrote a .tgz and refused nothing, because the output path did not already exist. The JSON file list matched the dev build list. tar on that archive showed four members, each under package/, and no secret.env. The marker file can sit in the project directory through validate, dev, and build, and it still does not enter the artifact. The exclusion is the declaration, not a guess about the filename. A file you meant to ship and forgot to declare is excluded the same way.

A second project checked the other side of that boundary. Its CLAW.md body said an API token was a synthetic token-shaped string, and that the string must not ship. templates validate --json exited 0. ok was true. diagnostics was empty. excludedPaths was empty. The body was not rewritten and was not flagged. The templates page says known private paths and credential-like text are rejected. This string was not rejected. Do not treat a clean validate as a scan of the prose. Read the body before you add. If a real token is in that paragraph, the next step turns the paragraph into SOUL.md.

What the add wrote

No gateway was listening. templates add of the local directory, with --json and --workspace pointed at a new directory, exited 0. The result said status complete, workspaceCreated true, and configCommitted true. A line before the JSON said the opening greeting was skipped because no usable model or sign-in was available. That line is not a failed add. The agent record was still written.

workspaceFiles named two paths. SOUL.md had sourcePath CLAW.md. AGENTS.md had sourcePath workspace/AGENTS.md. The skill package status was complete, source bundled, relationship managed. The workspace directory held those two files and skills/checklist/SKILL.md. SOUL.md was the heading and the two sentences. The YAML block was gone. AGENTS.md was the declared sentence, unchanged. A search of the new home for the marker in secret.env found nothing.

The dry run that preceded this add did not pass --workspace. Its plan named a workspace under the state directory, workspace- plus the agent id. That directory was still absent after the dry run. The mutating add used the path the flag named. The plan integrity on the dry run was not the plan integrity on the add. The templates page says an online add, when a local gateway owns the state directory, selects the workspace on the gateway and rejects --workspace. This run had no gateway. The offline add accepted the flag. Do not copy the online refusal onto an offline command, and do not store a dry-run hash as the receipt for an add that changes the workspace path. Pass the same --workspace on the dry run if that hash is the thing you intend to compare.

The home gained a state directory and an agent database in addition to the workspace. Those files are the local record of the agent, not a copy of the project. They were created under the disposable home. They were not created under the account home.

The dry-run plan set capabilityEscalations to 1. The bundled skill was classified as an escalation. requiresDistinctConsent was true. The reason text said the template includes bundled dependency content. The add command did not pass --accept-capabilities. The skill directory was still written, and the package status was still complete.

The templates page says online plugin installation requires --accept-capabilities, and that dependency trust warnings additionally require --acknowledge-clawhub-risk. This dependency was a folder in the project, not a plugin and not a ClawHub release. The add was offline. The plan’s consent field described the skill. It did not block the install. If the skill should not land, remove the path from CLAW.md and validate again. Do not treat a missing flag as a refusal this command will enforce.

A second add is a second agent

The same directory was added again with a different --agent-id and a different --workspace. The command exited 0. status was complete. requestedId in the result stayed the id from CLAW.md. finalId was the id passed on the command line. The display name became the original name, a space, and 2. A second workspace held the same three files. The first workspace was still there.

The page says add is one-way. There is no installed template to update or remove, and adding the same template again creates another agent. This run did that, with an explicit unused id so the second agent did not have to collide with the first. There is no templates remove. Deleting an agent is agents delete, and that command was not run. Both agents remained. An unattended job that retries add after a timeout has to look for the first agent before it creates a second one. A lost reply is not evidence that the first add failed. This run’s first add returned complete, so the second add was a deliberate second agent, not a retry of an unknown result.

The second add also printed a warning that plugin-source cleanup could not take the state lock, because the disposable home was writable by the group and had no sticky bit. The log directory was refused for the same reason on both adds. Both commands still exited 0. A missing log is not a missing agent. Tighten the home before you treat a dropped log line as the outcome. The outcome is the JSON status and the files in the workspace.

What to require before an unattended add

Point HOME at a directory you can delete. Run templates create on an empty path and require filesWritten to be only package.json and CLAW.md. Replace the generated manifest with the declarations you mean. Leave undeclared any file you do not want in the new workspace, and do not assume a filename such as secret.env is special. The exclusion in this run was the absence of a declaration.

Run templates validate --json. Require ok true, read diagnostics, and read excludedPaths. Then run templates dev --json or templates build and read the file list. The list this build produced was the four packaged paths above. secret.env was excluded in all three reports and absent from the archive. Then read the Markdown body yourself. A synthetic token-shaped string in that body was not a diagnostic.

Run templates add --dry-run --json with the same --workspace you will pass to the real add, if you pass one. Require the plan’s workspace file actions to name SOUL.md and the bootstrap files you declared, and no other project file. Then run the add. Require status complete. Open SOUL.md and confirm the front matter is gone and the body is the text you wrote. Open each declared file and confirm the bytes. Search the new home for a marker you left in an undeclared file. Absence is the success condition for that file.

If the plan lists a capability escalation, check the workspace after the add even when you did not pass --accept-capabilities. On this build the bundled skill was installed without that flag. If a second add is not what you want, do not retry a completed add to confirm it. List the agent id first. A skipped greeting means no model signed in. It does not mean the workspace is empty.

Sources