Move code between a live Pharo image and its Tonel files, and tell the two apart. Use before exporting image changes, after a checkout moves under the image, before saying what is or is not committed, and whenever Iceberg, the image and the files disagree.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Pharo Image Sync?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/evref-bl-pharo-image-sync)
---
name: pharo-image-sync
description: Move code between a live Pharo image and its Tonel files, and tell the two apart. Use before exporting image changes, after a checkout moves under the image, before saying what is or is not committed, and whenever Iceberg, the image and the files disagree.
---
# Pharo Image Sync
The image holds objects, the repository holds files, and Iceberg holds its own
idea of both. A clean `git status` does not mean the image is clean, and an
Iceberg diff does not mean anything was written to disk.
Git itself is ordinary shell work. These tools only cross the boundary between
the image and the files.
## What Is Committed
The user may commit through Iceberg at any time, and nothing tells you. What
you remember changing is not evidence that it is uncommitted, so ask before
calling anything unsaved or at risk.
- `git log` in the checkout says what was committed. Iceberg commits are
ordinary git commits, so it answers even when the image does not.
- `repository_search` with `isModified` names the repositories and packages
Iceberg marks as changed since the commit the image refers to; its commits
and diffs read only those. Exporting leaves the marks as they are;
committing, adopting HEAD and reloading recompute them against HEAD. A mark
says where to look, not that something differs: an edit that was undone, or
a test that compiled and removed a method, leaves one too.
- `repository_change_list` compares a repository's marked packages with its
files, every package once git moved HEAD outside the image, and names those
that really differ, and the files git sees changed.
Anything not committed is in one of them.
- To know whether one change is committed, compare `method_get` with the
class's file at `HEAD` (`git show HEAD:<path>`).
`git status` cannot answer for the image: Iceberg writes files only when it
commits or exports, so the checkout stays clean while the image holds changes.
## Out Of The Image
1. Verify which repository you are about to write to: `repository_search` for
its location, branch and packages, then `repository_identity_verify` with
what you expect, which fails rather than guessing.
2. Read the image-side diff with `repository_change_list` before writing
anything.
3. `repository_export` writes the repository's packages from the image, in
the checkout's format, and names the files that changed and anything
else left uncommitted. It stages and commits nothing.
4. Read what it wrote with `git diff`. Export writes what the image holds,
which includes anything loaded into it that you did not put there.
5. Commit with `repository_commit`, or with git and then
`repository_head_adopt`, which makes the new commit the one the image
refers to. Until it does, `repository_commit` and
`repository_change_discard` refuse, and the change list and export warn.
## Into The Image
A checkout that moves under a running image leaves it running the old code.
After a branch switch, a pull, a merge, a rebase or another image's export,
`repository_reload` loads the packages from the files again.
Reloading can leave classes behind in `Undeclared` when a superclass moved,
with subclasses still parented to an obsolete one. The symptom is tests failing
on classes nobody edited. Load that package again by name to repair it.
## Stop And Ask
Stop when two registrations claim the same packages, when the branch, source
directory or package membership is not what you expect, when a head is detached
or missing, or when Iceberg and the files disagree for no reason you can name.
Resolving real divergence, or discarding image changes, is the user's call.
## Report
Say what the image held, what was written, which files changed, and what you
did not verify.