Skip to content

feat(pull): reverse-sync evolved skills + agent context files#28

Merged
vanducng merged 1 commit into
mainfrom
feat/pull-reverse-sync
Jun 13, 2026
Merged

feat(pull): reverse-sync evolved skills + agent context files#28
vanducng merged 1 commit into
mainfrom
feat/pull-reverse-sync

Conversation

@vanducng

Copy link
Copy Markdown
Contributor

Why

Agents with skill_evolve/self_evolve (van-anh, lan-runner, and now master's Friday+Juno) mutate their skill source and SOUL/CAPABILITIES at runtime. Those changes diverge from git and get overwritten on the next apply unless captured. gcplane pull is the missing reverse direction: read evolved artifacts back into the repo for review + commit.

Command

gcplane pull -f <tenant-dir> [--kind skill|context-files] [--all] [--dry-run] [--prune-skill-files]
  • Reuses the apply/diff manifest loader (endpoint/token/tenantId from manifest.yaml).
  • Default pulls skills with source ∈ {gcplane, evolution} already declared locally; --all relaxes (excludes bundled/system).
  • --dry-run prints a diff, writes nothing.

Round-trip

agent evolves skill → gcplane pull -f shtp --kind skill --dry-run → review →
gcplane pull -f shtp --kind skill → git diff → commit → apply re-stamps source=gcplane

How it reads (full fidelity, no goclaw changes)

  • Skills: GET /v1/skills/{id}/files (tree) + per-file ?raw=true (raw bytes → binary-safe).
  • Context files: GET /v1/agents/{id}/export?sections=context_files → untar context_files/ prefix only (skips per-user files + agent.json).

Safety

  • skillpkg.UnpackTo: sha256-idempotent (clean diffs), rejects ../abs paths + zip-slip, skips hidden/system artifacts, MaxFileSize cap, prune off by default.
  • Never writes secrets — strictly read-from-goclaw, write-to-repo.

Tests

  • go build ./... && go vet ./... && go test -race ./... green.
  • New: skillpkg/unpack_test.go, skill_download_test.go, context_files_download_test.go, cmd/pull_test.go (source-filter, --all, dry-run-writes-nothing, idempotency).
  • Read endpoints validated against prod master (skill tree + raw read + context-files export).

Scope (v1)

Skills + agent contextFiles only — the two artifact classes evolution mutates. Providers/channels/MCP/cron/etc. stay git-authoritative (carry write-only secrets; not evolution targets). Design: goclaw-config/plans/reports/design-260614-0255-gcplane-pull-and-evolution.md.

…Claw

Adds `gcplane pull -f <tenant> [--kind skill|context-files] [--all] [--dry-run]`
to write self-evolved skill trees and agent context files back into the repo so
runtime changes can be reviewed in a git diff and re-committed.

- DownloadSkill: GET /v1/skills/{id}/files (tree) + per-file ?raw=true (raw bytes).
- DownloadAgentContextFiles: GET /v1/agents/{id}/export?sections=context_files,
  untar the context_files/ prefix only.
- skillpkg.UnpackTo: sha256-idempotent writes, rejects traversal/abs paths, skips
  hidden/system artifacts, caps MaxFileSize, optional prune.
- Default pulls source in {gcplane,evolution}; --all relaxes (excludes bundled/system).
- ResourceInfo.Source added so the skill source filter works.
- Never writes secrets (read-from-goclaw, write-to-repo only).
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@vanducng, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 29 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b8154808-fe18-4403-9d49-37fbedee0e43

📥 Commits

Reviewing files that changed from the base of the PR and between 9d3186c and 0962dd8.

📒 Files selected for processing (13)
  • cmd/pull.go
  • cmd/pull_test.go
  • cmd/root.go
  • internal/provider/goclaw/context_files.go
  • internal/provider/goclaw/context_files_download_test.go
  • internal/provider/goclaw/helpers.go
  • internal/provider/goclaw/http_client.go
  • internal/provider/goclaw/list_all.go
  • internal/provider/goclaw/skill_download_test.go
  • internal/provider/goclaw/skills.go
  • internal/reconciler/types.go
  • internal/skillpkg/unpack.go
  • internal/skillpkg/unpack_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pull-reverse-sync

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vanducng vanducng merged commit b05821f into main Jun 13, 2026
6 checks passed
@vanducng vanducng deleted the feat/pull-reverse-sync branch June 13, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant