@yibi/skills-sync
v0.2.5
Published
Exact Git-backed file projection for local agent skills.
Readme
Yibi Skills Sync
@yibi/skills-sync mirrors local agent skill files into a Git monorepo and projects committed files to OpenSearch. Git is mandatory and authoritative; OpenSearch is a rebuildable projection.
The data path is deliberately small:
original files -> exact Git mirror -> Git diff -> exact file projectionEach Git blob becomes one source record. File bytes are never merged, decoded, wrapped, truncated, or rewritten. Hidden files, unknown suffixes, extensionless files, and binary files follow the same path. The only exclusions are Git's own .git data and the plugin's legacy generated .yibi-skill-source.json file.
Install
npm install -g @yibi/skills-syncFor local development from this repo:
npm linkQuick Start
yibi-skills probe --json
yibi-skills init --preset local-agent-common
yibi-skills config validate
yibi-skills snapshot
yibi-skills bootstrap --json
yibi-skills repo status --json
yibi-skills status --json
yibi-skills watchFor portable setup, use the bundled skills/yibi-skills-bootstrap skill. The skill instructs the device-local agent to run probe, write an explicit sourceRoots config for that machine, then call snapshot and bootstrap.
Agent Handover Setup
When handing this project to an agent on a new machine, keep the setup linear and evidence-based. Use the default paths unless the user gives explicit portable paths:
yibi-skills probe --json
yibi-skills init --preset local-agent-common
yibi-skills config validate
yibi-skills snapshot
yibi-skills bootstrap --json
yibi-skills service install
yibi-skills service start
yibi-skills service status --jsonStop if config validate fails, if bootstrap reports no usable snapshot skills, or if service status --json reports configValid: false. service install writes a user service for the resolved config, state dir, and monorepo; service start starts the watcher. On macOS this is a launchd user agent, and on Linux this is a systemd --user unit.
For a portable handover under ~/.yibi, keep the same flags on every command so the service points at the same runtime state:
yibi-skills probe --json
yibi-skills init --preset local-agent-common --config ~/.yibi/skills-sync/config.json --state-dir ~/.yibi/skills-sync --monorepo ~/.yibi/skills-monorepo
yibi-skills config validate --config ~/.yibi/skills-sync/config.json --state-dir ~/.yibi/skills-sync --monorepo ~/.yibi/skills-monorepo
yibi-skills snapshot --config ~/.yibi/skills-sync/config.json --state-dir ~/.yibi/skills-sync --monorepo ~/.yibi/skills-monorepo
yibi-skills bootstrap --config ~/.yibi/skills-sync/config.json --state-dir ~/.yibi/skills-sync --monorepo ~/.yibi/skills-monorepo --json
yibi-skills service install --config ~/.yibi/skills-sync/config.json --state-dir ~/.yibi/skills-sync --monorepo ~/.yibi/skills-monorepo
yibi-skills service start --config ~/.yibi/skills-sync/config.json --state-dir ~/.yibi/skills-sync --monorepo ~/.yibi/skills-monorepo
yibi-skills service status --json --config ~/.yibi/skills-sync/config.json --state-dir ~/.yibi/skills-sync --monorepo ~/.yibi/skills-monorepoDefault paths:
- Config:
~/.config/yibi-skills-sync/config.json - State:
~/.local/state/yibi-skills-sync - Audit monorepo:
~/.local/share/yibi-skills-sync/skills-monorepo
bootstrap initializes this audit monorepo locally. It does not choose or create a remote repository. Check the effective destination after setup:
yibi-skills repo status --jsonThe output includes the exact local path, current branch and commit, and all configured Git remote URLs. If remotes is empty, the captured Skills exist only on that machine and cannot be pulled elsewhere.
The legacy audit path is capture/audit only. A Git pull into the audit monorepo does not install or update Skill files in local agent directories. Skills Synchronization V2 is a separate explicit path described below; it never treats the audit monorepo as a personal or central authority.
Skills Platform
The platform commands operate on a separate, explicitly supplied authority repository. They do not turn the local audit monorepo into a distribution source and never default to installed Skill roots.
Authority repository layout:
registry/skills/<yibi.id>.json Canonical identity, ownership, provenance
skills/<yibi.id>/ Admitted Skill content
versions/<yibi.id>.json Independent monotonic revisions
channels/<yibi.id>.json Candidate and stable references
governance/audit/ Promotion and rollback decisionsThe core flow is explicit:
# Validate or admit one approved Skill.
yibi-skills registry validate --repo /path/to/yibi-studio-skills --json
yibi-skills registry admit --repo /path/to/yibi-studio-skills --manifest ./admission.json --content ./approved-skill --json
# Commit the admitted content, then record its independent revision.
yibi-skills version record --repo /path/to/yibi-studio-skills --id yibi.example --source-commit HEAD --json
# Promote through candidate before stable with separate owner decisions.
yibi-skills release promote --repo /path/to/yibi-studio-skills --id yibi.example --revision 1 --to candidate --approval ./candidate-approval.json --json
yibi-skills release promote --repo /path/to/yibi-studio-skills --id yibi.example --revision 1 --to stable --approval ./stable-approval.json --json
# Discover and install stable content into an explicit client root.
yibi-skills distribution discover --repo /path/to/yibi-studio-skills --json
yibi-skills distribution diff --repo /path/to/yibi-studio-skills --client-root /path/to/client --agent codex --id yibi.example --json
yibi-skills distribution install --repo /path/to/yibi-studio-skills --client-root /path/to/client --agent codex --id yibi.example --jsonSupported agent placements are Codex, Claude, Hermes, and OpenClaw. Client lock
state lives at <client-root>/.yibi-skills/lock.json. An existing unlocked
target or content that no longer matches its lock is reported as local
divergence and is never overwritten. Installed directories and SKILL.md names
use the Skill's ordinary frontmatter name; canonical yibi.* and personal.*
ids remain only in registry, lock, receipt, ownership, and source metadata.
Ordinary-name collisions fail before any target is written.
Migration is conservative and recoverable:
yibi-skills migration classify --source-root /path/to/legacy-skills --json
yibi-skills migration verify --repo /path/to/yibi-studio-skills --client-root /path/to/client --agent codex --id yibi.example --json
yibi-skills migration cutover --repo /path/to/yibi-studio-skills --client-root /path/to/client --agent codex --id yibi.example --legacy-path /path/to/client/legacy/example --confirm-retire --jsonmigration classify never auto-admits content. Cutover re-verifies installed
bytes, moves only the named legacy directory into the client-local retired area,
and writes a receipt; it does not delete the legacy content.
Self-iteration is candidate-PR-only. It requires a clean main, explicit
evidence, a passing evaluation, one existing Skill, and a provider adapter:
yibi-skills self-iteration propose --repo /path/to/yibi-studio-skills --id yibi.example --candidate ./candidate-skill --evidence ./evidence.json --evaluation ./evaluation.json --submit-command ./submit-pr --jsonThe command cannot merge or promote and does not expose any stable-channel mutation.
Skills Synchronization V2
V2 Simple separates personal authoring from central intake:
personal Skill checkout -> user's organization-private repository
|
+-> organization discovery -> central intakePersonal identities use personal.github-<numeric-id>.<slug> and require a
matching personal.json. The repository is always
yibi-studio/github-<numeric-id>-skills on main. Personal push uses the Git
authentication already available to the process and does not depend on a
central registration, intake decision, or device record.
Public command groups are:
yibi-skills source guide|verify
yibi-skills personal sync
yibi-skills intake poll|decide
yibi-skills authority update
yibi-skills compose apply|status
yibi-skills sync-service render|run-once|start|stop|status|readiness|uninstallFirst-time installation must start with the bundled
Personal Source Setup Guide.
source guide uses authenticated gh read-only to derive the immutable
github-<numeric-id> identity, verify organization membership and policy, and
emit the exact organization-private gh repo create ... --add-readme command.
The installing Agent presents that command to the user; repository creation is
never implicit. source verify reads back the exact owner, private visibility,
non-archived state, main, current-user write access, organization base read
access, clone URL, and remote HEAD. Neither command reads or writes central
state.
personal sync accepts only the explicit personal checkout, local state root,
and immutable user id. It fetches first, fast-forwards only clean history,
validates and stages only owned Skill paths, performs a normal push, compares
remote HEAD literally, and writes an atomic local lock. It never resets,
restores, stashes, rebases conflicts, or force-pushes.
intake poll enumerates all GitHub organization repository pages and accepts
only matching private, non-archived, readable main sources. It deduplicates by
commit and Skill, isolates inaccessible repositories, and writes only its own
cursor/item state. Operator decisions are receipts and never promote stable.
The Simple source path does not install, replace, load, or restart a service. Existing authority update, composition, and lifecycle commands remain separate modules and are not prerequisites for personal push.
To run the complete device loop automatically, use a simple-device lifecycle
config. The personal checkout remains the authoring source; installed Agent
directories are materialized targets and are never reverse-captured:
{
"mode": "simple-device",
"pollIntervalSeconds": 300,
"executablePath": "/absolute/path/to/yibi-skills",
"environmentPath": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"ghCommand": "/opt/homebrew/bin/gh",
"sourceRepo": "/absolute/path/to/github-123-skills",
"stateRoot": "/absolute/path/to/sync-state",
"userId": "github-123",
"organization": "yibi-studio",
"authorityRemote": "https://github.com/yibi-studio/skills.git",
"authorityCheckout": "/absolute/path/to/authority-checkout",
"clientRoot": "/absolute/path/to/client-home",
"agent": "codex"
}Set "intakeEnabled": true on the designated intake host to discover the
newly pushed personal commit in the same cycle. Discovery writes pending local
intake receipts only; it never promotes central candidate or stable content.
To enroll an existing owner-local Skill without uploading unrelated installed content, add an explicit binding:
{
"personalSources": [
{
"sourcePath": "/absolute/path/to/yibi-svg-flowchart",
"id": "personal.github-123.svg-flowchart"
}
]
}The first cycle imports and pushes that Skill. Later cycles propagate a change
from exactly one side and fail closed when both the local source and personal
repository changed since the last successful lock. The personal repository and
every Agent installation preserve the original frontmatter name; the
personal.* id is metadata, not a callable alias.
Run and verify one cycle before loading the timer:
yibi-skills sync-service render --home "$HOME" --config /absolute/path/to/sync-v2.json --json
yibi-skills sync-service run-once --config /absolute/path/to/sync-v2.json --json
yibi-skills sync-service start --home "$HOME" --json
yibi-skills sync-service status --home "$HOME" --json
yibi-skills sync-service readiness --home "$HOME" --config /absolute/path/to/sync-v2.json --jsonThe cycle performs central-free personal synchronization, a fast-forward-only
central authority update, and source-aware composition. It writes the last
successful result to <stateRoot>/service/last-run.json. Rendered services use
the absolute executable and separate stdout/stderr logs. When environmentPath
is omitted, rendering discovers the installed node, git, and gh command
directories and adds system fallbacks. Start, stop, and uninstall target only
the V2 label/timer and do not change the legacy watcher.
Reading this repository does not itself create a GitHub repository, change permissions, push commits, install Skills, or load a service. Those effects occur only when the corresponding lifecycle commands are explicitly run.
Override with --config, --state-dir, --monorepo, or environment variables:
YIBI_SKILLS_SYNC_CONFIGYIBI_SKILLS_STATE_DIRYIBI_SKILLS_MONOREPO
Configuration
{
"sourceRoots": [
{ "path": "~/.codex/skills", "sourceSystem": "codex-skills", "tier": "live", "depth": 1 },
{ "path": "~/.agents/skills", "sourceSystem": "agent-skills", "tier": "live", "depth": 1 },
{ "path": "~/.hermes/skills", "sourceSystem": "hermes-skills", "tier": "live", "depth": 3 }
],
"monorepo": { "path": "~/.local/share/yibi-skills-sync/skills-monorepo" },
"review": { "mode": "auto" },
"ingest": { "enabled": false, "command": "" },
"watch": { "intervalSeconds": 2, "ignore": [] }
}review.mode controls whether watch commits detected changes automatically:
manual:watchonly discovers and records dirty changes.auto: each polling cycle mirrors all dirty source changes, creates one scoped Git commit, and runs ingest once for that commit when enabled.
When ingest.enabled is false, commits are still recorded in Git and ingest is marked skipped in state.
When ingest.enabled is true and ingest.command is empty, the built-in path projects last_ingested_commit..HEAD from Git. The first run is a full Git-tree projection. A successful real ingest advances the cursor; dry runs and failures do not. OpenSearch parsing or indexing failures are recorded as downstream failures and never cause source files to be filtered or modified.
Every projected record uses document.type = "file". Its identity comes from the logical Git path and its revision comes from the raw file SHA-256. Deletions are emitted as tombstones.
To enable an explicit shell adapter:
{
"ingest": {
"enabled": true,
"command": "python3 /path/to/ingest.py --monorepo {monorepo} --commit {commit} --load --json",
"dryRunCommand": "python3 /path/to/ingest.py --monorepo {monorepo} --commit {commit} --load --dry-run-ingest --json"
}
}Available placeholders: {commit}, {fromCommit}, {full}, {monorepo}, {stateDir}.
To enable the built-in direct ingest path without an external shell wrapper:
{
"review": { "mode": "auto" },
"ingest": {
"enabled": true
}
}To upload accepted monorepo commits through the KB Multipart Upload API:
{
"ingest": {
"enabled": true,
"type": "kb-upload-api",
"baseUrl": "http://127.0.0.1:18080",
"tokenEnv": "KB_UPLOAD_API_TOKEN",
"sourceSystem": "yibi-skills-sync"
}
}Set the token outside the config when possible:
export KB_UPLOAD_API_TOKEN='kbup_...'
yibi-skills retry-ingest --commit HEAD --dry-run-ingest --json--dry-run-ingest sends metadata.preflight=true to the upload API. Active records retain their original basename and suffix; deleted records are sent as tombstone metadata. The adapter records the returned job_id, status_url, and result_url in local state.
Commands
yibi-skills init
yibi-skills probe --json
yibi-skills config validate
yibi-skills snapshot
yibi-skills bootstrap --json
yibi-skills capture --path ~/.codex/skills/example/SKILL.md
yibi-skills status --json
yibi-skills review --json
yibi-skills commit --json
yibi-skills retry-ingest --commit HEAD --json
yibi-skills service install
yibi-skills service startwatch uses short polling over the configured skill roots and the current state baseline. Each polling cycle re-discovers the configured roots, so newly created skill directories are picked up automatically.
- In
manualmode, those changes staydirtyuntil you runreviewandcommit. - In
automode, all changes found in one cycle share one Git commit and one ingest attempt.status --jsonexposes the commit and downstream ingest result.
Use capture --path ... when you want to force an immediate one-off capture for a specific path instead of waiting for the next poll cycle.
Service Management
macOS uses launchd user agents. Linux uses systemd --user units.
yibi-skills service install
yibi-skills service start
yibi-skills service status
yibi-skills service stop
yibi-skills service uninstallDevelopment
npm test
python3 -m pytest testThe Python engine is vendored under python/. git_file_projector.py is the single implementation used by the runtime and the isolated projection experiment.
