Skip to content

Export installed agents as grouped Claw packages - #102306

Merged
giodl73-repo merged 4 commits into
mainfrom
user/giodl/claws-pr7-export
Jul 22, 2026
Merged

giodl73-repo merged 4 commits into
mainfrom
user/giodl/claws-pr7-export

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary - add experimental claws export <agent-id> --out <new-directory> - project one installed agent into the grouped portable Claw schema - copy ledger-managed workspace files and safe workspace-relative avatars into package sidecars - always assign regenerated exports a derivative package identity and content-derived version - omit nonportable remote avatars, normalize empty optional arrays, and expand ~ in output paths ## Scope Export reads the provenance established by the add/status lifecycle and writes a new self-contained package without mutating the installed Claw. It accepts an exact agent id, explicitly projects portable agent fields, copies only ledger-managed workspace files plus a validated local avatar, emits exact recorded package references, and refuses unavailable managed files or an existing output directory. Image data avatars remain inline. A safe local avatar is read through the pinned workspace avatar boundary, copied under workspace/, and rewritten to a workspace-relative manifest path. Remote, missing, or unsafe local avatars are omitted because they are not portable package state. Every regenerated package is emitted as openclaw-claw-<agent-id>@0.0.0-export.<content-hash>, including an unchanged installation. Export never reuses an authenticated publisher's package name/version unless it can return the byte-for-byte original artifact, which this command intentionally does not do. This slice emits the schema's JSON-compatible representation. The later dedicated #111391 slice changes the canonical exported representation to CLAW.md while preserving this package and round-trip behavior. ## Stack - RFC: openclaw/rfcs#27 - Depends on: #102296 status/remove and ownership-aware lifecycle state - This PR: portable creation/export experience - Next: #102383 gateway-owned cron lifecycle - Canonical CLAW.md: #111391 ## Validation - node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.src.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-src.tsbuildinfo - Oxlint: 0 warnings, 0 errors across all 6 PR files - Oxfmt: all 6 PR files correctly formatted - 8 export unit tests - 15 Claws CLI tests - 8 full lifecycle E2E tests - git diff --check - Codex review: no accepted/actionable findings ## Real behavior proof > Signing-history note (2026-07-19): signed-history head 830f057a4f46 is a commit-history-only rewrite of previously tested head 01179a6693e3; both resolve to tree b070e62df6bc. The behavior evidence below remains source-equivalent. This note does not claim a new runtime execution. The real CLI E2E passes consent-bound add preview/apply -> export -> inspect -> consent-bound add preview/apply from the exported package in isolated state. Export writes package.json, openclaw.claw.json, managed workspace sidecars, and a portable agent manifest; the fresh add recreates the agent from the derivative package. ## Documentation Extends /cli/claws with grouped JSON export and its portable-state boundary. Canonical CLAW.md export remains in #111391.

Independent review refresh (2026-07-19)

Current exact head: 4576fbf3ecb2382a5e020d4d6cdde43906ba18cc. Restacks unchanged export behavior on the corrected lifecycle parent. Fresh exact-head GitHub CI is authoritative for generated-package and SQLite-backed checks.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

New stacked Claws PR for the creation/export experience. Please review claws export against the RFC/lifecycle stack, especially export -> apply consistency for workspace/persona files, plugin selector reuse, include/exclude behavior, and the safety checks around symlink escapes, oversized/non-regular files, duplicate targets, and unique entry ids.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: L labels Jul 8, 2026
@clawsweeper

clawsweeper Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Jul 8, 2026
@clawsweeper

clawsweeper Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 20, 2026, 5:18 PM ET / 21:18 UTC.

Summary
Adds experimental claws export <agent> --out <path> support that projects one installed agent into a derivative portable package with managed workspace and safe-avatar sidecars.

PR surface: Source +416, Tests +406, Docs +15. Total +837 across 8 files.

Reproducibility: not applicable. as a bug reproduction: this PR adds new experimental behavior. The supplied transcript does provide a healthy CLI round trip, but it does not prove the intended degraded-state outcomes on the current head.

Review metrics: 1 noteworthy metric.

  • Public CLI surface: 1 experimental command added. claws export creates a portable package contract whose output and failure semantics will be consumed by later Claws lifecycle stages.

Stored data model
Persistent data-model change detected: database schema: src/claws/export.test.ts, database schema: src/claws/export.ts, database schema: src/claws/lifecycle.e2e.test.ts, database schema: src/cli/claws-cli.runtime.ts, database schema: src/cli/claws-cli.test.ts, serialized state: src/claws/export.test.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add final-head redacted terminal proof for healthy export plus the chosen drifted, unavailable, or partial-state outcome.
  • Record the maintainer decision on exact-state-only export versus any future explicit snapshot mode in the PR discussion.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR includes useful redacted live CLI output for a healthy isolated add → export → inspect → add round trip, but it does not show final-head behavior for the documented drifted, unavailable, or partial managed-state paths; add redacted terminal output for the selected contract and update the PR body for re-review.

Risk before merge

  • [P1] The public contract says drifted managed state fails, but the supplied real behavior transcript only covers a healthy complete installation; maintainers cannot yet assess the user-visible failure and recovery behavior for unavailable, drifted, or partial state.
  • [P1] The feature creates a portable package contract that downstream Claws stages consume; the project still needs an explicit decision on whether export is exact-state-only or whether a separately disclosed snapshot mode should ever exist.

Maintainer options:

  1. Prove the exact-state contract (recommended)
    Before merge, retain fail-closed export for degraded managed state and add final-head terminal evidence for the successful and selected failure/recovery paths.
  2. Pause for package-policy direction
    Do not merge this slice until maintainers decide whether portable export represents only healthy exact state or can produce a labeled degraded snapshot.

Next step before merge

  • [P1] A maintainer must select the permanent degraded-state export policy, and the contributor must supply final-head real CLI proof for that choice; neither is a safe automated repair task.

Maintainer decision needed

  • Question: Should experimental claws export require a complete, corroborated installed Claw by default, with degraded state rejected, or should the product also support an explicitly labeled snapshot export mode?
  • Rationale: The diff and docs commit to rejecting drift, while review discussion asks for stronger completeness and lineage semantics; that policy defines the portable package contract and cannot be safely selected by an automated repair.
  • Likely owner: Patrick-Erichsen — Patrick-Erichsen is the active assignee and authored the current repair commit after reviewing the relevant safety and portability boundary.
  • Options:
    • Exact state only (recommended): Require complete, provable managed state for export and retain the documented fail-closed behavior for drift or unavailable resources.
    • Add an explicit snapshot mode later: Keep this PR exact-state-only and design a separately named snapshot mode with a machine-readable drift report in a later, maintainer-sponsored change.
    • Defer export: Pause this slice until the broader Claws lifecycle and its portable-package semantics have explicit product approval.

Security
Cleared: No concrete security or supply-chain regression is evident in the reviewed CLI, file-boundary, test, and documentation changes; the latest head specifically moves avatar-sidecar reads to the bounded reader.

Review details

Best possible solution:

Keep the default export contract exact and fail closed for incomplete or drifted managed state, then add final-head redacted CLI proof for the healthy round trip and each selected degraded-state outcome before landing this stack slice.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction: this PR adds new experimental behavior. The supplied transcript does provide a healthy CLI round trip, but it does not prove the intended degraded-state outcomes on the current head.

Is this the best way to solve the issue?

Unclear. The exact-state, fail-closed design is the narrower maintainable default, but maintainers must decide whether that is the permanent product contract before the implementation can be considered the best solution.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 21bfc75648d1.

Label changes

Label justifications:

  • P2: This is a bounded experimental CLI feature that needs product and proof completion but does not report an urgent user regression.
  • merge-risk: 🚨 compatibility: The new export artifact establishes package identity, manifest, and managed-state semantics that must remain consistent with import and downstream lifecycle work.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • feature: ✨ showcase: ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. Portable, provenance-aware export of an installed agent can unlock reproducible role packages while deliberately excluding host-local credentials, sessions, and unrelated state.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR includes useful redacted live CLI output for a healthy isolated add → export → inspect → add round trip, but it does not show final-head behavior for the documented drifted, unavailable, or partial managed-state paths; add redacted terminal output for the selected contract and update the PR body for re-review.
Evidence reviewed

PR surface:

Source +416, Tests +406, Docs +15. Total +837 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 416 0 +416
Tests 3 406 0 +406
Docs 2 21 6 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 843 6 +837

What I checked:

  • Changed export boundary: The proposed exportClawAgent creates a new package artifact, derives a new package identity/version, reads provenance through the Claws lifecycle, and writes only portable managed workspace/avatar state. (src/claws/export.ts:1, cc8d2df28faf)
  • Public contract: The documentation says export fails when managed state has drifted and explicitly excludes unrelated agents, credentials, sessions, and unowned local state; this makes the degraded-state policy a user-visible CLI contract. Public docs: docs/cli/claws.md. (docs/cli/claws.md:185, cc8d2df28faf)
  • Final-head change after proof: The latest commit replaces the file-reading path with the current bounded reader, but the PR's supplied real CLI transcript is tied to earlier source-equivalent heads and only proves a healthy add → export → inspect → add round trip. (src/claws/export.ts:1, cc8d2df28faf)
  • Stack and ownership context: The export branch is based on the still-open lifecycle PR and is itself the base for the still-open cron PR; the related CLAW.md work changes representation rather than providing a merged replacement for this export feature. (src/claws/lifecycle.e2e.test.ts:265, cc8d2df28faf)
  • Review-history context: The prior ClawSweeper review found no discrete code defect but required a maintainer decision on degraded-state export and real evidence for the chosen behavior. The supplied current discussion does not establish that the missing degraded-state proof was added. (4576fbf3ecb2)

Likely related people:

  • Patrick-Erichsen: Authored the current head commit that updates the bounded file-read path, supplied the original concrete review findings, and was assigned shortly before the latest head updates. (role: recent review and repair contributor; confidence: medium; commits: cc8d2df28faf; files: src/claws/export.ts)
  • giodl73-repo: Authored the export implementation and the adjacent lifecycle, cron, update, and format slices that define this feature's provenance and portability boundary. (role: Claws stack author; confidence: medium; commits: 20798cfd6083, 2f5ef4de16f5, cbaad8a8e573; files: src/claws/export.ts, src/claws/export.test.ts, src/claws/lifecycle.e2e.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (23 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-19T16:35:00.726Z sha 01179a6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T17:14:16.162Z sha 01179a6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T17:54:35.797Z sha 830f057 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T18:09:41.850Z sha 830f057 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T21:22:29.238Z sha 7bd3dafe333d1abfba46b93b3d45256f33a5540e :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T21:40:47.354Z sha 68205169d4016612f427b6d5d24e1507421a60af :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T22:05:46.533Z sha 4576fbf :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-19T22:11:02.300Z sha 4576fbf :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 8, 2026
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr6-lifecycle branch from 49eb30a to 5ada027 Compare July 10, 2026 03:49
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr7-export branch from b3be1ee to ed66eab Compare July 10, 2026 03:53
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 10, 2026
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr6-lifecycle branch from 5ada027 to d11434d Compare July 10, 2026 13:25
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr7-export branch from ed66eab to 06b1e17 Compare July 10, 2026 14:17
@giodl73-repo giodl73-repo changed the title Add Claw manifest export command Export installed agents as grouped Claw packages Jul 10, 2026
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr6-lifecycle branch from d11434d to 93f5186 Compare July 10, 2026 16:50
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr7-export branch from 06b1e17 to 59f8ce3 Compare July 10, 2026 16:50
@clawsweeper clawsweeper Bot added the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Jul 18, 2026
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr6-lifecycle branch 3 times, most recently from dd16b2f to f683f60 Compare July 18, 2026 14:55
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr7-export branch from eb903fc to d14318e Compare July 18, 2026 14:59
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr6-lifecycle branch from f683f60 to 047e33d Compare July 19, 2026 14:08
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr7-export branch from d14318e to f1ff89e Compare July 19, 2026 14:09
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 19, 2026
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr6-lifecycle branch from 047e33d to fafa698 Compare July 19, 2026 14:32
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr7-export branch from f1ff89e to 01179a6 Compare July 19, 2026 14:33
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 19, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 19, 2026
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr6-lifecycle branch from fafa698 to ebd50cb Compare July 19, 2026 17:50
@giodl73-repo
giodl73-repo force-pushed the user/giodl/claws-pr7-export branch from 01179a6 to 830f057 Compare July 19, 2026 17:50
@clawsweeper clawsweeper Bot removed the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Jul 19, 2026
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Signed-history proof carry-forward:

  • previously tested head: 01179a6693e3
  • current signed head: 830f057a4f46
  • identical Git tree: b070e62df6bcd8492d817639ae88fa1cb4263282

The rewrite only compacted iterative fix commits and replaced commit identity/signatures; the PR's source tree and diff are unchanged. The existing Real behavior proof remains applicable. This attestation does not claim a new runtime execution; fresh CI is validating the rewritten SHA.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Independent review refresh applied at 7bd3dafe333d. Restacked export on the final lifecycle contract without widening whole-instance scope. Focused cumulative contract tests and git diff --check pass; fresh exact-head CI is running. No merge performed.

@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Export installed agents as grouped Claw packages This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Export installed agents as grouped Claw packages This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Export installed agents as grouped Claw packages This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: Export installed agents as grouped Claw packages This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants