Skip to content
Agentmart
Submit a tool

main-sync

Inspect and safely align one Git repository's canonical main checkout with its fetched origin default branch.

Skill by maheen-ejaz

IndexedMIT
Write a review

Chalk Labs

Need help deploying main-sync?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/maheen-ejaz-main-sync

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Inspect and safely align one Git repository's canonical main checkout with its fetched origin default branch. Invoke explicitly with `/skill:main-sync [repository path]`.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/main-sync

What's inside

Skill name
main-sync
Description
Inspect and safely align one Git repository's canonical main checkout with its fetched origin default branch. Invoke explicitly with `/skill:main-sync [repository path]`.
License
MIT
Instructions
22 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Main checkout health and sync

Use only when explicitly invoked as `/skill:main-sync [repository path]`. If no path is supplied, use the current working directory. Operate on one repository per invocation; do not scan the workspace or guess a repository path.

## Rules

- Diagnose before changing anything. Fetching remote-tracking metadata with `git fetch --no-prune origin` is allowed for this explicit sync request; never prune.
- Identify the repository root, then resolve the *live* default branch and HEAD SHA with `git ls-remote --symref origin HEAD`; do not trust a possibly stale local `origin/HEAD` alias. Fetch the exact advertised branch into its `refs/remotes/origin/<branch>` ref and verify that fetched SHA still matches the live remote HEAD before presenting a change. If the branch or SHA keeps moving, stop and report it. Do not print the remote URL.
- If the live default cannot be resolved unambiguously, stop and ask the user how to resolve that; never assume `main` or `master`.
- Identify the worktree actually checked out on the live default branch, its `HEAD`, upstream, complete porcelain status including untracked files, and any merge/rebase/cherry-pick/revert in progress.
- If the canonical checkout is clean and exactly equals its fetched default ref, report that no action is needed.
- If it is clean and strictly behind only, use the structured `ask_user_question` tool to offer: (1) fast-forward this exact checkout to the displayed fetched SHA, (2) inspect incoming commits first, or (3) leave it unchanged. Recommend the fast-forward. After approval, fetch and resolve the live default again; if its branch or SHA changed, ask again. Otherwise revalidate the exact path, branch, `HEAD`, clean status, and no in-progress operation immediately before `git merge --ff-only`.
- If dirty, never stash, reset, checkout, clean, or overwrite. Show changed paths and use `ask_user_question` to offer inspecting the diff to form a preservation plan (recommended), or leaving it unchanged. Do not offer a destructive cleanup as a resolution.
- If ahead or diverged, show the local-only and remote-only commits and offer to inspect them and propose a reconciliation plan, or preserve the checkout unchanged. Do not merge, rebase, reset, or force-align automatically.
- If the invoked directory is not the canonical default-branch worktree, identify the canonical path and offer to inspect it or leave it alone; do not switch the current checkout. Ask before any action on another exact path.
- On fetch errors, wrong branch, in-progress Git state, missing upstream, or ambiguous identity, stop and use `ask_user_question` to offer safe diagnosis or cancellation. Every question must present concrete consequences; if no safe mutation is available, the choices must remain read-only.

## Completion

After any approved fast-forward, verify that the same worktree is clean and its `HEAD` exactly equals the target SHA. Report the path, branch, old/new `HEAD`, and outcome. If approval is cancelled or checks no longer match, make no change and report why.

From maheen-ejaz/pi-agent-config, MIT.

More from maheen-ejaz/pi-agent-config

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Sep 24, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from maheen-ejaz

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get main-sync running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying main-sync?

CallGet help
Cite this page

main-sync skill. Agent Mart. https://agentmart.dev/skills/maheen-ejaz-main-sync (last updated 2026-10-24)