Skip to content

Commit 133ffe3

Browse files
committed
refactor(skills): reconcile only the listed skills and review weekly
Collection review plans now list only writes and drops; unlisted skills stay untouched and count as kept. Read receipts and tree hashes are required only for the skills a plan changes, so a skill the model cannot read in full is left alone instead of blocking the whole review. The collection read budget is model-relative with no absolute cap, and the review runs weekly instead of daily.
1 parent 4c44986 commit 133ffe3

20 files changed

Lines changed: 204 additions & 153 deletions

‎docs/cli/skills.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Notes:
142142
| `curator --json` | Accepted before or after a Curator leaf command, for example `curator --json status` or `curator status --json`. |
143143
| `list` | Default action when no subcommand is provided. |
144144
| `list`/`info`/`check` output | Rendered output goes to stdout. With `--json`, the machine-readable payload stays on stdout for pipes and scripts. |
145-
| `curator status --json` | Returns legacy age-based lifecycle state written by older releases. Daily collection review does not use this state. |
145+
| `curator status --json` | Returns legacy age-based lifecycle state written by older releases. Weekly collection review does not use this state. |
146146

147147
Community ClawHub skill installs and updates check trust before downloading.
148148
Versioned community archive releases use exact-release trust metadata.

‎docs/tools/self-learning.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ Every learned skill receives these controls:
158158
already above the cap can only become shorter.
159159
- **Rollback metadata:** apply records the prior skill and support-file contents
160160
before the live write.
161-
- **Collection review:** once a day in `auto` mode, an isolated model session
162-
reads the workspace skills. Externally owned skills must be kept; only
161+
- **Collection review:** once a week in `auto` mode, an isolated model session
162+
reads the skills it intends to change. Externally owned skills stay untouched; only
163163
Workshop-owned paths can be rewritten or dropped. Collection-created skills
164164
receive automatically applied `create` proposal records.
165165
- **Collection backup:** review validates and scans every rewrite before changing
@@ -178,7 +178,7 @@ openclaw skills workshop reject <proposal-id> --reason "Not reusable"
178178
```
179179

180180
Applied captures remain visible in `openclaw skills workshop list` and retain
181-
their rollback metadata. The daily collection review can later improve, merge,
181+
their rollback metadata. The weekly collection review can later improve, merge,
182182
or remove them. This makes
183183
approval-free learning reversible and observable rather than silent.
184184

@@ -210,15 +210,15 @@ The reviewer reuses the foreground provider, model, and available auth identity,
210210
with model fallbacks disabled. Provider pricing and data-handling terms apply to
211211
the additional run.
212212

213-
Daily collection review also uses the configured agent model. It receives the
213+
Weekly collection review also uses the configured agent model. It receives the
214214
names, descriptions, and ownership state of eligible workspace skills, then reads each
215-
complete skill before making one atomic collection change. Disabled and
215+
skill it intends to change before one atomic call listing only changes. Disabled and
216216
agent-filtered skills stay untouched. Shared workspaces use the union of each
217217
agent's allowed skills only when provider, model, and resolved auth identity
218218
match. Reconciliation must leave every sharing agent at least one visible skill.
219219
It has no message tool or general agent tools. Skill bodies are treated as
220220
untrusted evidence, not as instructions. A persisted per-workspace attempt time
221-
prevents Gateway restarts from repeating a failed or successful review within 24 hours. The
221+
prevents Gateway restarts from repeating a failed or successful review within 7 days. The
222222
foreground agent can restore the one retained collection backup when asked to
223223
undo the cleanup, unless an affected skill changed afterward.
224224

@@ -271,7 +271,7 @@ result pending regardless of autonomous mode.
271271

272272
| Setting | Default | Effect |
273273
| ------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------ |
274-
| `skills.workshop.autonomous.mode` | `"auto"` | Chooses capture behavior; `auto` also enables daily collection review. |
274+
| `skills.workshop.autonomous.mode` | `"auto"` | Chooses capture behavior; `auto` also enables weekly collection review. |
275275
| `skills.workshop.approvalPolicy` | `"auto"` | Controls prompts for normal agent-initiated lifecycle calls. It never expands the isolated reviewer tool surface. |
276276
| `skills.workshop.maxPending` | `50` | Caps pending and quarantined proposals per workspace. |
277277
| `skills.workshop.maxSkillBytes` | `40000` | Caps proposal body size in bytes. |

‎docs/tools/skill-workshop.md‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ Only a `pending` proposal can be revised, applied, rejected, or quarantined.
5858
## Collection review
5959

6060
In `auto` mode, the Gateway starts one isolated collection-review session per
61-
agent workspace each day. The session can only read skills and submit
62-
one complete collection reconciliation. It keeps distinct useful skills,
61+
agent workspace each week. The session can only read skills and submit
62+
one atomic collection reconciliation listing only changes. It keeps distinct useful skills,
6363
rewrites weak ones, consolidates overlap, and drops junk or stale fragments.
6464
Choosing `auto` intentionally authorizes those rewrites and drops without a
6565
second approval **for Workshop-owned paths only**; `propose` and `off` do not
6666
run collection review.
6767

68-
Every eligible workspace skill must be read and receive exactly one decision.
69-
Skills without applied Workshop create provenance are read-only and must receive
70-
`keep`; Workshop-owned skills may receive `keep`, `write`, or `drop`. A new
68+
The reviewer reads each skill it intends to change. Unlisted skills stay untouched.
69+
Skills without applied Workshop create provenance are read-only; Workshop-owned
70+
skills may receive `write` or `drop`. A new
7171
skill created during collection review is recorded as an automatically applied
7272
`create` proposal, which makes that directory Workshop-owned. Disabled and
7373
agent-filtered skills stay untouched.
@@ -89,8 +89,8 @@ To undo the last completed cleanup, ask the agent to restore the skill
8989
collection. It uses `skill_workshop` action `restore_collection` under the same
9090
workspace lock. Restore refuses if any affected skill changed after cleanup.
9191

92-
The daily attempt is persisted per workspace before the model starts. Gateway
93-
restarts do not repeat a failed or successful attempt within 24 hours. Review is admitted only for collections of at most
92+
The weekly attempt is persisted per workspace before the model starts. Gateway
93+
restarts do not repeat a failed or successful attempt within 7 days. Review is admitted only for collections of at most
9494
200 skills and 240,000 total `SKILL.md` bytes. Larger collections stay unchanged.
9595
The reconciled result must stay inside the same byte limit.
9696

@@ -100,7 +100,7 @@ the latest 90 outcomes per workspace.
100100

101101
Collection rewrites and merges produce `SKILL.md` files at or below 10,000
102102
characters. A skill already above the cap can only become shorter. User-authored
103-
skills always receive `keep`.
103+
skills stay untouched.
104104

105105
## Chat
106106

@@ -375,13 +375,13 @@ the proposal threshold, and troubleshooting.
375375
}
376376
```
377377

378-
| Setting | Default | Effect |
379-
| -------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
380-
| `autonomous.mode` | `"auto"` | `"off"` disables autonomous capture, `"propose"` creates pending captures, and `"auto"` applies captures and runs daily cleanup that can rewrite or drop Workshop-owned skills. |
381-
| `allowSymlinkTargetWrites` | `false` | Lets apply write through workspace skill symlinks whose real target is listed in `skills.load.allowSymlinkTargets`. |
382-
| `approvalPolicy` | `"auto"` | `"auto"` skips an additional prompt for agent-initiated `apply`, `reject`, or `quarantine` (the agent still has to call the action). `"pending"` requires approval. |
383-
| `maxPending` | `50` | Caps pending and quarantined proposals per workspace (1-200). |
384-
| `maxSkillBytes` | `40000` | Caps manual and foreground proposal body size in bytes (1024-200000). Autonomous results have a 10,000-character cap. |
378+
| Setting | Default | Effect |
379+
| -------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
380+
| `autonomous.mode` | `"auto"` | `"off"` disables autonomous capture, `"propose"` creates pending captures, and `"auto"` applies captures and runs weekly cleanup that can rewrite or drop Workshop-owned skills. |
381+
| `allowSymlinkTargetWrites` | `false` | Lets apply write through workspace skill symlinks whose real target is listed in `skills.load.allowSymlinkTargets`. |
382+
| `approvalPolicy` | `"auto"` | `"auto"` skips an additional prompt for agent-initiated `apply`, `reject`, or `quarantine` (the agent still has to call the action). `"pending"` requires approval. |
383+
| `maxPending` | `50` | Caps pending and quarantined proposals per workspace (1-200). |
384+
| `maxSkillBytes` | `40000` | Caps manual and foreground proposal body size in bytes (1024-200000). Autonomous results have a 10,000-character cap. |
385385

386386
In `propose` and `auto` modes, an isolated run of the selected model decides whether the
387387
completed trajectory clears the evidence-gated proposal bar. The foreground model is not prompted
@@ -422,7 +422,7 @@ Proposal descriptions are always capped at 160 bytes, independent of
422422

423423
`skills.curator.status` also reports the latest collection and experience review
424424
outcome per workspace. The other curator methods manage lifecycle state written
425-
by older releases. Daily review does not use age, pin, or overlap state.
425+
by older releases. Weekly review does not use age, pin, or overlap state.
426426

427427
`requestRevision` is Gateway-only (no CLI or agent-tool equivalent): it
428428
forwards free-text revision instructions to the owning agent's chat session

‎src/agents/tools/skill-workshop-tool-collection.ts‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const skillCollectionPlanSchema = Type.Optional(
6969
Type.Array(
7070
Type.Object(
7171
{
72-
action: stringEnum(["keep", "write", "drop"] as const),
72+
action: stringEnum(["write", "drop"] as const),
7373
name: Type.String(),
7474
description: Type.Optional(Type.String({ maxLength: 160 })),
7575
content: Type.Optional(Type.String()),
@@ -80,7 +80,7 @@ export const skillCollectionPlanSchema = Type.Optional(
8080
{
8181
maxItems: MAX_RECONCILED_SKILLS,
8282
description:
83-
"Exactly one decision for every current skill, plus optional new write decisions. Skills not created by Skill Workshop are read-only and require keep. write requires description and complete SKILL.md content; drop requires a reason.",
83+
"Only the skills to change; unlisted skills stay. write requires description and complete SKILL.md content; drop requires a reason. Skills not created by Skill Workshop are read-only.",
8484
},
8585
),
8686
);
@@ -210,9 +210,6 @@ function readCollectionPlanParam(params: Record<string, unknown>): SkillCollecti
210210
}
211211
const action = readToolStringParam(entry, "action", { required: true });
212212
const name = readToolStringParam(entry, "name", { required: true });
213-
if (action === "keep") {
214-
return { action, name };
215-
}
216213
if (action === "drop") {
217214
return {
218215
action,
@@ -228,9 +225,9 @@ function readCollectionPlanParam(params: Record<string, unknown>): SkillCollecti
228225
content: readToolStringParam(entry, "content", { required: true, trim: false }),
229226
};
230227
}
231-
throw new ToolInputError(`collection[${index}].action must be keep, write, or drop`);
228+
throw new ToolInputError(`collection[${index}].action must be write or drop`);
232229
});
233230
}
234231

235232
export const SKILL_COLLECTION_ACTION_DESCRIPTION =
236-
"read = inspect one current skill; reconcile = atomically keep, rewrite, create, or drop the whole writable skill collection.";
233+
"read = inspect one current skill; reconcile = one atomic call that rewrites, creates, or drops the listed skills; unlisted skills stay.";

‎src/agents/tools/skill-workshop-tool-description.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function buildSkillWorkshopToolDescription(params: {
1010
return `Inspect and revise only the proposal revision selected by the operator. The proposal id and expected revision hash are bound by the run and cannot be replaced by tool arguments. Never apply, reject, quarantine, or create another proposal.\n\n${SKILL_AUTHORING_STANDARDS_PROMPT}`;
1111
}
1212
if (params.collectionOnly) {
13-
return `${SKILL_WORKSHOP_TOOL_DISPLAY_SUMMARY} Read every current writable skill, then replace the collection with one reconcile call. Every current skill needs exactly one keep, write, or drop decision.\n\n${SKILL_AUTHORING_STANDARDS_PROMPT}`;
13+
return `${SKILL_WORKSHOP_TOOL_DISPLAY_SUMMARY} Read the skills you intend to change, then finish with one reconcile call listing only writes and drops; unlisted skills stay. An empty collection records that nothing changed.\n\n${SKILL_AUTHORING_STANDARDS_PROMPT}`;
1414
}
1515
const repairPolicy =
1616
params.autonomousMode === "off"

‎src/agents/tools/skill-workshop-tool.projection.test.ts‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("skill_workshop model projection", () => {
3535
provider: "openai",
3636
model: "large-context",
3737
modelContextWindowTokens: 200_000,
38-
maxChars: 20_000,
38+
maxChars: 70_000,
3939
contentIncluded: true,
4040
},
4141
])(
@@ -96,14 +96,14 @@ describe("skill_workshop model projection", () => {
9696
{ modelContextWindowTokens: 8_192, contentIncluded: false },
9797
{ modelContextWindowTokens: 200_000, contentIncluded: true },
9898
])(
99-
"binds collection read receipts to a complete $modelContextWindowTokens-token projection",
99+
"handles a 21,000-character collection skill on a $modelContextWindowTokens-token model",
100100
async ({ modelContextWindowTokens, contentIncluded }) => {
101101
const workspaceDir = await tempDirs.make("openclaw-skill-collection-context-read-");
102102
await writeWorkspaceSkills(workspaceDir, [
103103
{
104104
name: "large",
105105
description: "Large procedure",
106-
body: `MODEL_VISIBLE_SKILL_BODY\n${"x".repeat(10_000)}`,
106+
body: `MODEL_VISIBLE_SKILL_BODY\n${"x".repeat(21_000)}`,
107107
},
108108
]);
109109
const tool = createConfiguredSkillWorkshopTool({
@@ -121,15 +121,23 @@ describe("skill_workshop model projection", () => {
121121
const text = read.content[0]?.type === "text" ? read.content[0].text : "";
122122
expect(read.details).toMatchObject({ skillKey: "large", contentIncluded });
123123
expect(text.includes("MODEL_VISIBLE_SKILL_BODY")).toBe(contentIncluded);
124-
const reconciliation = tool.execute("reconcile", {
125-
action: "reconcile",
126-
collection: [{ action: "keep", name: "large" }],
127-
});
128124
if (contentIncluded) {
129-
await expect(reconciliation).resolves.toMatchObject({ details: { kept: ["large"] } });
130-
} else {
131-
await expect(reconciliation).rejects.toThrow("Read every current skill");
125+
expect(text.length).toBeGreaterThan(21_000);
126+
}
127+
if (!contentIncluded) {
128+
expect(text).toContain(
129+
"Next: leave this skill unlisted in the reconcile call; only the operator can change it.",
130+
);
131+
await expect(
132+
tool.execute("change-rejected", {
133+
action: "reconcile",
134+
collection: [{ action: "drop", name: "large", reason: "Oversized" }],
135+
}),
136+
).rejects.toThrow("Read the skill before changing it: large");
132137
}
138+
await expect(
139+
tool.execute("reconcile", { action: "reconcile", collection: [] }),
140+
).resolves.toMatchObject({ details: { kept: ["large"] } });
133141
},
134142
);
135143

‎src/agents/tools/skill-workshop-tool.review.test.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ describe("skill_workshop review mode", () => {
400400
expect(proposalMutationBudget.remaining).toBe(0);
401401
});
402402

403-
it("lets an oversized skill shrink without a complete reviewer read", async () => {
403+
it("rejects oversized growth but permits shrink in review mode", async () => {
404404
const workspaceDir = await tempDirs.make("openclaw-skill-workshop-review-read-cap-");
405405
await seedLiveSkill(
406406
workspaceDir,
@@ -430,10 +430,8 @@ describe("skill_workshop review mode", () => {
430430
skill_name: "big-skill",
431431
});
432432
const text = (read.content[0] as { text: string }).text;
433-
expect(read.details).toMatchObject({ skillKey: "big-skill", contentIncluded: false });
434-
expect(text.length).toBeLessThanOrEqual(20_000);
435-
expect(text).toContain("Content omitted");
436-
expect(text).not.toContain("A detailed operational line.");
433+
expect(read.details).toMatchObject({ skillKey: "big-skill", contentIncluded: true });
434+
expect(text).toContain("A detailed operational line.");
437435

438436
await expect(
439437
reviewTool.execute("oversized-growth", {

‎src/agents/tools/skill-workshop-tool.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ describe("skill_workshop tool", () => {
8585

8686
expect(JSON.stringify(tool.parameters)).toContain('"enum":["read","reconcile"]');
8787
expect(JSON.stringify(tool.parameters)).toContain(
88-
"Exactly one decision for every current skill, plus optional new write decisions. Skills not created by Skill Workshop are read-only and require keep. write requires description and complete SKILL.md content; drop requires a reason.",
88+
"Only the skills to change; unlisted skills stay. write requires description and complete SKILL.md content; drop requires a reason. Skills not created by Skill Workshop are read-only.",
8989
);
90+
expect(JSON.stringify(tool.parameters)).toContain('"enum":["write","drop"]');
9091
expect(tool.description).toContain(SKILL_AUTHORING_STANDARDS_PROMPT);
9192
await tool.execute("read", { action: "read", skill_name: "duplicate" });
9293
await tool.execute("reconcile", {
@@ -136,7 +137,7 @@ describe("skill_workshop tool", () => {
136137

137138
const first = tool.execute("first", {
138139
action: "reconcile",
139-
collection: [{ action: "keep", name: "procedure" }],
140+
collection: [],
140141
});
141142
await expect(
142143
tool.execute("second", {

0 commit comments

Comments
 (0)