[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77HE1QN2X86B67BAJDRFK66":3,"skill-same:01M77HE1QN2X86B67BAJDRFK66":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":6,"updatedAt":37,"install":38,"resources":50},"01M77HE1QN2X86B67BAJDRFK66","git-subagent-sync",null,"Synchronize subagent changes to git on shared trunk across all lanes and all untracked WIP by default (or scoped via --lane\u002F--paths). Enforces single-source invariants, safe merge convergence via `fak sync check`, `fak sync reconcile --apply`, and `fak sync push`, dual-repo synchronization (fak & fak-private), disjoint file-tree fencing via `dos arbitrate`, detached build-isolation worktrees, and atomic coordinator landing via `fak sweep --apply` or `fak commit --path`. Prevents index corruption, off-trunk drift, peer clobbering, and unverified worker self-reports. Use when synchronizing subagent changes across lanes on shared trunk.","anthony-chaudhary\u002Ffak","anthony-chaudhary","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F18080164?v=4","01M77GSKCAEKV3JS07J40B94DY","Anthony Chaudhary","01M77GSKD26Z7F4FQQD4VA30VX",48,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fgit-subagent-sync\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: git-subagent-sync\ndescription: Synchronize subagent changes to git on shared trunk across all lanes and all untracked WIP by default (or scoped via --lane\u002F--paths). Enforces single-source invariants, safe merge convergence via `fak sync check`, `fak sync reconcile --apply`, and `fak sync push`, dual-repo synchronization (fak & fak-private), disjoint file-tree fencing via `dos arbitrate`, detached build-isolation worktrees, and atomic coordinator landing via `fak sweep --apply` or `fak commit --path`. Prevents index corruption, off-trunk drift, peer clobbering, and unverified worker self-reports. Use when synchronizing subagent changes across lanes on shared trunk.\ndisable-model-invocation: false\nuser-invocable: true\nallowed-tools: Read, Bash, Write, Edit, Grep, Glob, Task\nargument-hint: \"[--lane \u003Clane>] [--paths \u003Cp>...] [--worker-dir \u003Cdir>] [--push] (defaults to all lanes and all untracked WIP)\"\nmetadata:\n  opencode: agent-permission\n---\n\n# \u002Fgit-subagent-sync — Synchronize Subagent Changes to Git on Shared Trunk\n\nCoordinated, conflict-free synchronization protocol for parallel subagents and isolated workers operating on the shared trunk (`main`). By default, discovers, arbitrates, validates, and synchronizes **all lanes and all untracked WIP** across the repository (or narrows to an explicit `--lane` or `--paths` when provided). Prevents index lock collisions, uncommitted file cross-talk, branch drift, and peer clobbering by strictly enforcing coordinator-mediated git mutations, disjoint filesystem leases via `dos arbitrate`, detached build-isolation worktrees, and non-forgeable witness gates.\n\n## Core Invariants\n\n1. **`main-is-single-source`**: All committed work lands directly on trunk (`main`). Feature branches, side branches, and divergent branch worktrees are prohibited. The repository trunk guard rejects off-trunk transactions with `OFF_TRUNK`.\n2. **All lanes & untracked WIP by default**: In the absence of an explicit `--lane` or `--paths` constraint, synchronization automatically inventories the complete working tree, discovers all untracked WIP files (`??`), maps untracked files to their canonical lanes, arbitrates leases per lane, and drives each lane through isolated validation, package tests, atomic landing, and DOS witness gates.\n3. **Untracked WIP preservation**: Untracked source files (`??`) are first-class candidate WIP. They are mapped to their respective lane via `dos.toml` and committed as part of their package; they are never wiped, abandoned, or hidden behind wildcard `.gitignore` rules.\n4. **Explicit paths only (No blanket staging)**: Git staging and landing operations require explicit pathspecs. \"All lanes\" does NOT mean `git add -A` or a blanket commit; it means iterating over all dirty lanes and landing each lane group with explicit pathspecs and its bindable `(fak \u003Clane>)` stamp.\n5. **Detached worktrees only**: Concurrent filesystem isolation utilizes detached HEAD worktrees pinned at an explicit trunk SHA (`git worktree add --detach \u003Cpath> \u003Csha>` managed via `fak worktree worker prepare`). Never attach branch worktrees.\n6. **Safe Landing within Worker Boundaries**: Autonomous safe git sync landing (`fak sync check`, `fak sync reconcile --apply`, `fak commit --path`, `fak sync push`) is active by default working within each worker process upon test verification. Raw uncoordinated git commands (`git add -A`, raw unverified git commits\u002Fmerges) remain strictly prohibited.\n7. **Package-scoped verification only**: Verification executes within isolated scopes (`fak validate --mine \u003Cp>...` and targeted package tests under WSL\u002FLinux) without running unisolated global sweeps that contaminate clean builds with peer WIP.\n8. **Autonomous landing upon task completion by default**: When an agent, worker, or subagent completes any assigned task, it must follow the safe landing process itself by default working within each worker process rather than leaving uncommitted edits or waiting for interactive prompts. If coordinator context preservation or build isolation is required, the coordinator dispatches a dedicated landing\u002Fworker subagent to execute the verification and landing steps autonomously.\n9. **Safe Merge & Structured Convergence**: Strictly forbid unverified raw merges, `--autostash`, or force-pushes. Check for `.git\u002FMERGE_HEAD` (`MERGE_IN_PROGRESS`); if active, halt and wait. Integrate upstream via `fak sync check` and `fak sync reconcile --apply` (supporting `ROUTE_DISJOINT_INTEGRATE`, `ROUTE_SUPERSET_MERGE`, and `ROUTE_HOLD_DIRTY_COLLISION` with `fak wip park`).\n10. **Dual-Repo Synchronization (`fak` & `fak-private`)**: When cross-repo dependencies, shared interfaces (`pkg\u002F*`), or companion platform modules are touched, synchronize both repositories. Check dirty states, fetch remotes for both, fast-forward both (`fak sync reconcile --apply` in `fak`, `git pull --ff-only` or `fak-sync repo` in `fak-private`), run `go work sync`, and verify boundary leak safety (`python tools\u002Fscrub_public_copy.py --audit-staged`).\n11. **Strict Ban on PowerShell & Loose Scripts (Mandatory Modular Go Programs)**: Workers and subagents MUST NEVER author `.ps1` (PowerShell), `.sh`, `.bat`, or loose scripts. All new automation, tooling, testing, or lifecycle utilities MUST be implemented as modular, integrated Go programs (`cmd\u002F*`, Go leaves registered as `fak` CLI verbs, or quarantined sub-modules under `tools\u002F\u003Cname>\u002Fgo.mod`) providing long-term value. Unless there is an extraordinary, super heavily justified reason (~1 in entire repo), loose scripts are strictly banned.\n\n## Architecture & Roles\n\n```\n[Upstream Trunk: origin\u002Fmain]\n              │\n      Coordinator Process\n    ┌─────────┴─────────┐\n    │  - Pre-flight checks & fak sync check\n    │  - Full working-tree inventory (modified + all untracked WIP)\n    │  - Lane classification via `fak sweep --json` & `dos.toml`\n    │  - Multi-lane arbitration loop: `dos arbitrate` per lane\n    │  - Allocate detached worktree: `fak worktree worker prepare`\n    │  - Ingest receipts & verify independently (`fak validate`, `go test`)\n    │  - Atomic lane landing: `fak sweep --apply` \u002F `fak commit --path`\n    │  - Commit witness per lane: `dos commit-audit`, `dos verify`\n    │  - Handle no-lane residuals (goals, root configs)\n    │  - Final review audit: `dos review origin\u002Fmain..HEAD`\n    │  - Cleanup: `fak worktree worker reap` & lease release\n    └─────────┬─────────┘\n              │ (Fenced Worktree \u002F Write Boundary)\n      Subagent \u002F Worker\n    ┌─────────┴─────────┐\n    │  - Bounded implementation in allocated file tree\n    │  - Private compilation cache: GOCACHE, GOTMPDIR\n    │  - Local package unit tests\n    │  - Autonomous safe git landing: `fak sync check`, `fak sync reconcile --apply`, `fak commit --path`, `fak sync push`\n    │  - Emit structured completion receipt with commit SHA\n    └───────────────────┘\n```\n\n### Coordinator Responsibilities\n- Discover layout and active repository state via `dos doctor`, `git status --porcelain`, and `fak sweep --json`.\n- By default, inventory **all lanes and all untracked WIP**, grouping untracked files into their canonical lanes.\n- Acquire exclusive lane leases from `dos arbitrate` before initiating subagent dispatch or landing.\n- Provision detached worktree isolation via `fak worktree worker prepare` with dedicated build cache roots (`GOCACHE`, `GOTMPDIR`, `DISPATCH_WORKSPACE`).\n- Ingest worker completion receipts without trusting narrative assertions (\"tests pass\", \"complete\").\n- Independently verify candidate deltas per lane using isolated compilation checks (`fak validate --mine`) and targeted package test suites.\n- Execute atomic landing on trunk per lane using `fak sweep --apply --lane \u003Clane>`, `fak worktree worker land`, or locked explicit-path staging (`fak commit --path`).\n- Witness each landed commit via `dos commit-audit HEAD`, `dos verify fak \u003Cleaf>`, and `dos review`.\n- Reap detached worktrees and release lane leases upon completion.\n\n### Worker \u002F Subagent Responsibilities\n- Execute modifications strictly inside the declared file tree or assigned detached worktree directory.\n- Use isolated compiler directories defined in the environment.\n- Run local tests inside the private worktree or target package.\n- Adhere strictly to safe trunk landing: NEVER execute raw uncoordinated git commands (`git commit`, `git push`, `git checkout -b`, `git add -A`, `git reset`, or `git merge`). Instead, execute landing through the guarded fak verbs: `fak sync check`, `fak sync reconcile --apply`, `fak commit --path`, and `fak sync push` unprompted by default upon test verification.\n- Return a structured completion receipt specifying modified files, newly created files, test outputs, execution status, and the landed origin commit SHA.\n\n## Step-by-Step Execution Protocol\n\n### Phase 1: Pre-Flight, Full-Tree Census & Lane Discovery (All Lanes by Default)\n\n1. **Refresh upstream tracking and verify safe merge state**:\n   ```bash\n   fak sync check --fetch\n   fak sync reconcile --apply\n   ```\n   Inspect for mid-flight merges:\n   ```bash\n   test ! -f .git\u002FMERGE_HEAD || exit 4 # MERGE_IN_PROGRESS\n   ```\n   If a merge is active, pause and allow the owning process to resolve it. Never abort, reset, or finish a peer's merge.\n\n   **Dual-Repo Pre-flight (when cross-repo dependencies, shared interfaces `pkg\u002F*`, or companion modules are involved)**:\n   When coordinating changes across both `fak` and `fak-private`:\n   - Inspect dirty state in both checkouts (`git status --porcelain`).\n   - Fetch remotes and lock refs for both repositories (`fak sync check --fetch` in `fak`, `git fetch origin` \u002F `fak-sync repo` in `fak-private`).\n   - Inspect `.git\u002FMERGE_HEAD` in both checkouts; if either repository is in a merge state, unstage local paths and wait.\n   - Run `go work sync` to verify multi-module workspace graph alignment across both trees.\n\n2. **Verify index lock availability**:\n   Verify `.git\u002Findex.lock` is absent. If present, inspect lock staleness rather than forcing removal.\n\n3. **Full Working-Tree Inventory (Tracked + All Untracked WIP)**:\n   Capture the full dirty census across all lanes:\n   ```bash\n   git status --porcelain\n   fak sweep --json\n   ```\n   Parse all modified, deleted, and untracked (`??`) files:\n   - **Package source & tests**: map each untracked file to its canonical lane according to `dos.toml [lanes]` (e.g. `cmd\u002Ffak\u002Farms.go` -> `cmd`, `internal\u002Fcompute\u002Fnuma_topology.go` -> `compute`, `internal\u002Fgateway\u002Farms.go` -> `gateway`).\n   - **Goal specifications**: map `goals\u002F**` to the `goal` lane or `internal\u002Fgoalregistry`.\n   - **Documentation & notes**: map `docs\u002F**` to the `docs` lane.\n   - **Tooling & test scripts**: map `tools\u002F**` to the `tools` lane.\n   - **Root residuals**: group root-level files (`Makefile`, `campaign-baseline.json`) for explicit leaf stamping.\n\n4. **Determine Scope (All Lanes vs Explicit Lane)**:\n   - If `--lane \u003Clane>` or `--paths \u003Cp>...` is explicitly passed, narrow execution to that specific lane or pathset.\n   - **Default**: Select **all discovered lanes** with dirty tracked or untracked WIP files for sequential synchronization.\n\n### Phase 2: Multi-Lane Arbitration & Ordering\n\n1. **Order Discovered Lanes**:\n   Sort discovered lanes to land dependencies before dependents (e.g. core libraries `internal\u002Fmodel`, `internal\u002Fcompute`, `internal\u002Fgateway` before entrypoints `cmd\u002Ffak`, and docs\u002Ftooling after code).\n\n2. **Acquire Exclusive Lane Lease**:\n   For each target lane in the queue, query the lane arbiter before modifying or committing:\n   ```bash\n   dos arbitrate --workspace . --lane \u003Clane> --kind keyword --mode exclusive --tree \u003Clane_paths>...\n   ```\n   Ensure outcome is `acquire`. If outcome is `refuse`, proceed to the next disjoint lane or back off if blocked by transient contention (`LOCK_BUSY`).\n\n3. **Provision Detached Worktree (When Dispatching Isolated Subagents)**:\n   When coordinating isolated workers, allocate a detached worktree directory pinned to trunk `HEAD`:\n   ```bash\n   fak worktree worker prepare --lane \u003Clane> --key \u003Ctask-or-issue-id>\n   ```\n   Capture `worker_worktree` and `base_sha` from the JSON payload.\n\n### Phase 3: Per-Lane Receipt Ingestion & Independent Verification\n\nFor each lane being synchronized:\n\n1. **Audit touched files against arbitration fence**:\n   Extract modified and untracked paths for this lane. Assert every path belongs to the arbitrated file-tree lease. Reject unmapped paths outside the lease (`COLLISION_RISK`).\n\n2. **Validate prospective delta in isolation**:\n   Run isolated compilation, formatting, and vetting across the lane's modified AND untracked paths:\n   ```bash\n   fak validate --mine \u003Clane_paths>...\n   ```\n   Confirm build, vet, and formatting pass while masking peer WIP.\n\n3. **Execute targeted test witness on-device**:\n   Run package tests for the target lane (WSL\u002FLinux on Windows):\n   ```bash\n   go test -v .\u002Finternal\u002F\u003Clane>\u002F...\n   go vet .\u002Finternal\u002F\u003Clane>\u002F...\n   ```\n   Proceed only when execution yields `CLAIM_TEST_GREEN`. Never accept worker-narrated test success without coordinator verification.\n\n### Phase 4: Per-Lane Atomic Trunk Landing\n\nFor each verified lane:\n\n1. **Prepare Conventional Commit subject**:\n   Format subject line with DCO sign-off (`-s`) and bindable lane trailer `(fak \u003Cleaf>)`:\n   ```\n   \u003Ctype>(\u003Cscope>): \u003Cconcise summary> (fak \u003Cleaf>)\n   ```\n\n2. **Lint commit message and paths**:\n   ```bash\n   fak commit --preview -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" --path \u003Clane_paths>...\n   ```\n\n3. **Safe divergence handling and merge routing**:\n   Before executing landing, check if upstream advanced during arbitration or verification:\n   - Strictly avoid unverified raw git merges, `--autostash`, or force-pushes.\n    - Route divergence through structured reconciliation:\n      ```bash\n      fak sync check\n      fak sync reconcile --apply\n      ```\n      Execute the evaluated safe route:\n      - `ROUTE_APPLY`: clean fast-forward convergence via `fak sync reconcile --apply` (or `fak sync apply`).\n     - `ROUTE_DISJOINT_INTEGRATE`: disjoint commit file-trees merged cleanly.\n     - `ROUTE_SUPERSET_MERGE`: textless `-s ours` verified convergence.\n     - `ROUTE_HOLD_DIRTY_COLLISION`: if uncommitted local paths collide, park them safely via `fak wip park` (or `--suspend-paths`), converge, and reapply.\n   - Re-verify prospective package tests with `fak validate --mine` after convergence before landing the commit.\n\n4. **Execute atomic trunk landing**:\n   **Option A — In-Tree Lane Sweep Landing (`fak sweep --apply`)**:\n   ```bash\n   fak sweep --apply --lane \u003Clane> -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" [--push]\n   ```\n   **Option B — In-Tree Locked Commit (`fak commit --path`)**:\n   ```bash\n   fak commit \\\n     --path \u003Cp1> --path \u003Cp2> ... \\\n     -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" \\\n     [--push]\n   ```\n   **Option C — Detached Worktree Landing (`fak worktree worker land`)**:\n   ```bash\n   fak worktree worker land \\\n     --worktree \"\u003Cworker_worktree>\" \\\n     --paths \u003Clane_paths>... \\\n     --verify go-build \\\n     --msg-file \"\u003Cprepared-msg-file>\"\n   ```\n\n   For a recovery-capable local attempt, carry the **original granted** Source\n   tuple on direct land and on **both** verified `land prepare` \u002F `land accept`:\n   `--source-lease-id \u003Cid> --source-lease-holder \u003Cholder> --source-lease-generation \u003Cpositive-generation>`.\n   The Source ref must be in the **target repository's Git common store**. The\n   worker validates the live tuple and verifies its current ref OID in the same\n   Git transaction as final trunk CAS. Direct-ref type and live tuple are rechecked\n   while Git's prepared ref locks are held, before the commit decision; TTL is a\n   decision-time check, not a zero-duration wall-clock expiry guarantee.\n   A heartbeat changes OID, not the immutable\n   presented tuple. Prepared receipts bind `source_lease`; omission or relabeling\n   at accept refuses. Missing\u002Fexpired\u002Fsuperseded leases refuse. Transaction\n   contention requires actual ref readback before retry; it is not proof of an\n   observed no-mutation terminal. Fenced requests never use shared-index legacy\n   or pending-debt modes. Existing no-tuple calls remain unfenced compatibility;\n   installing this code does **not** fence any already-running older binary or\n   prove that an unknown historical process drained. No cross-clone arbitration\n   or atomic sibling-repository lease\u002Ftarget transaction is claimed.\n\n5. **Verify commit claim shape & leaf stamp immediately**:\n   ```bash\n   dos commit-audit HEAD\n   dos verify fak \u003Cleaf>\n   ```\n   Confirm verdict is `OK` (`diff-witnessed`) and `shipped: true`.\n\n6. **Reap worker worktree if used**:\n   ```bash\n   fak worktree worker reap --worktree \"\u003Cworker_worktree>\" --superseded-by HEAD\n   ```\n\n### Phase 5: No-Lane Residuals, Push & Multi-Lane Summary Receipt\n\n1. **Synchronize No-Lane Residuals**:\n   For any remaining untracked files with no auto-inferred lane:\n   - `goals\u002F**`: commit with stamp `(fak goal)` or record in goal lifecycle.\n   - Root configs \u002F tooling (`Makefile`, `campaign-baseline.json`): commit with explicit paths and matching leaf (e.g. `(fak build)`, `(fak devindex)`).\n   - Proven disposable junk: clean with `fak sweep --clean-junk` or `fak tree-doctor --sweep-scratch`.\n\n2. **Confirm zero residual review debt**:\n   ```bash\n   dos review origin\u002Fmain..HEAD\n   ```\n   Confirm `has_residual` is `false`.\n\n3. **Push to trunk & dual-repo coordination**:\n   If `--push` was requested or trunk is green, push landed commits safely.\n\n   **Single-repo push (`fak` only)**:\n   ```bash\n   fak sync push\n   ```\n   `fak sync push` automatically retries non-fast-forward races when a peer lands between fetch and push while HEAD already contains origin, and halts safely on genuine divergence.\n\n   **Dual-repo push (`fak` & `fak-private`)**:\n   When cross-repo dependencies, shared interfaces (`pkg\u002F*`), or companion platform modules were modified:\n   - Audit the staged\u002Fcommitted public delta for private leak needles before push:\n     ```bash\n     python tools\u002Fscrub_public_copy.py --audit-staged\n     ```\n     Ensure zero leak needles (exit code 0).\n   - Push companion `fak-private` changes first or synchronously using its sanctioned workflow (`fak-sync push --apply`).\n   - Push `fak` commits via `fak sync push`.\n   - Confirm both repositories have reached their intended synchronized tip.\n\n4. **Emit structured sync receipt**:\n   ```json\n   {\n     \"schema\": \"fak-subagent-sync\u002F1\",\n     \"mode\": \"all-lanes\",\n     \"lanes_synced\": [\"agent\", \"compute\", \"gateway\", \"cmd\"],\n     \"untracked_wip_cleared\": 43,\n     \"commits\": [\n       {\n         \"lane\": \"agent\",\n         \"commit_sha\": \"\u003Csha1>\",\n         \"paths\": [\"internal\u002Fagent\u002Fblackboard_bench_test.go\", \"internal\u002Fagent\u002Fsubagent_synthesis.go\"],\n         \"witness\": { \"test\": \"CLAIM_TEST_GREEN\", \"audit\": \"diff-witnessed\", \"stamp\": \"shipped\" }\n       },\n       {\n         \"lane\": \"compute\",\n         \"commit_sha\": \"\u003Csha2>\",\n         \"paths\": [\"internal\u002Fcompute\u002Fdecode_numapool.go\", \"internal\u002Fcompute\u002Fnuma_topology.go\"],\n         \"witness\": { \"test\": \"CLAIM_TEST_GREEN\", \"audit\": \"diff-witnessed\", \"stamp\": \"shipped\" }\n       }\n     ],\n     \"status\": \"ALL_LANES_COMMITTED\"\n   }\n   ```\n\n## Refusal & Recovery Matrix\n\n| Refusal Token | Exit Code | Trigger Condition | Exact Recovery Action |\n|---|---|---|---|\n| `LOCK_BUSY` | 3 | Another process holds `.git\u002Findex.lock` or the advisory commit lock. | Wait with backoff (e.g. 500ms, 1s, 2s). In multi-lane mode, proceed to next disjoint lane or wait for lock release; do not remove active locks manually. |\n| `WRITER_LEASE_HELD` | 3 | Worktree writer lease held by an active sync-apply window (#4240). | Transient contention. Back off and poll until writer lease clears, then retry landing. |\n| `MERGE_IN_PROGRESS` | 4 | A git merge is active (`.git\u002FMERGE_HEAD` exists). | Strictly forbid unverified raw merges, `--autostash`, or force-pushes. If the merge is owned by a peer, do not abort or finish it; unstage local paths and wait. If resolving owned convergence, integrate via `fak sync reconcile --apply` (or `fak sync apply` `--ff-only`) or `fak sync reconcile` (`ROUTE_DISJOINT_INTEGRATE` \u002F `ROUTE_SUPERSET_MERGE` \u002F `ROUTE_HOLD_DIRTY_COLLISION` with `fak wip park`). |\n| `PATHSPEC_RACE` | 1 | Staged commit contained files outside the requested explicit pathspec. | Commit was held locally unpushed. Inspect `git show --stat HEAD`, verify unrequested paths, unstage them, and never force-push. |\n| `PUSH_REJECTED` | 1 | Remote rejected push (non-fast-forward conflict on origin). | Never force-push or rebase with `--autostash`. Run `fak sync check`, then `fak sync reconcile --apply` (or `fak sync apply`), re-verify affected packages, and push with `fak sync push`. If cross-repo work was landed, synchronize and push both `fak` and `fak-private`. |\n| `STALE_BASE_DELETION` | 4 | Working copy predates upstream modifications and would silently overwrite peer lines. | Refresh modified paths from `origin\u002Fmain`, reapply the subagent delta onto the fresh baseline, re-run tests, and re-commit. |\n| `STALE_UNTRACKED` | 4 | Path is untracked locally but already exists on origin\u002Fmain. | Local HEAD is behind remote. Run `fak sync check --fetch` and compare via `git show origin\u002Fmain:\u003Cpath>` before landing. |\n| `COLLISION_RISK` | 4 | Requested write tree overlaps with a concurrent active lease holder. | Run `dos arbitrate --workspace .` to inspect conflicting holders. Wait for lease expiration or select an alternate disjoint lane from `free_clusters`. If dirty paths collide during convergence, park conflicting WIP via `fak wip park` (`ROUTE_HOLD_DIRTY_COLLISION`). |\n| `DUAL_REPO_SKEW` | 4 | Interface mismatch or un-synchronized commits between `fak` and companion `fak-private` across shared packages (`pkg\u002F*`). | Synchronize remotes for both repos, run `go work sync`, re-verify interface compatibility across workspaces, and align commits. |\n| `PUBLIC_LEAK_DETECTED` | 1 | Staged or committed public copy contains private needles or credentials. | Run `python tools\u002Fscrub_public_copy.py --audit-staged`, scrub offending private artifacts, and never push until leak check exits 0. |\n| `OFF_TRUNK` | 4 | Current working tree is detached or checked out on a branch other than `main`. | Return to trunk via `fak sync apply` (or `git checkout main`). Sanctioned worker worktrees (`fak worktree worker`) are exempt when landing via CAS. |\n| `CORE_SELF_MODIFY` | 4 | Attempted modification of frozen\u002Fcore-locked files (e.g. `internal\u002Fabi\u002F**`, policy anchors). | Abort unauthorized modification. If permitted by maintenance mandate, provide explicit `--core-lock-maintenance-witness \u003Cclaim>`. |\n\n## Verification and Witness Gate\n\nEvery execution of `git-subagent-sync` must pass the following checkable verification commands before declaring synchronization complete:\n\n1. **Prospective Build & Vet Isolation**:\n   ```bash\n   fak validate --mine \u003Cpaths>...\n   ```\n   *Exit criteria*: Exit code 0; zero compile errors, gofmt clean, vet clean.\n\n2. **Targeted Package Test Execution**:\n   ```bash\n   go test -v .\u002Finternal\u002F\u003Clane>\u002F...\n   go vet .\u002Finternal\u002F\u003Clane>\u002F...\n   ```\n   *Exit criteria*: Exit code 0; status is `CLAIM_TEST_GREEN`.\n\n3. **Commit Subject & Leaf Lint**:\n   ```bash\n   fak commit --preview -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" --path \u003Cpaths>...\n   ```\n   *Exit criteria*: Exit code 0; Conventional Commits syntax valid, DCO present, trailer matches active lane.\n\n4. **Diff Witness Verification**:\n   ```bash\n   dos commit-audit HEAD\n   ```\n   *Exit criteria*: Verdict `OK`, witness category `diff-witnessed`.\n\n5. **Stamp Recognition**:\n   ```bash\n   dos verify fak \u003Cleaf>\n   ```\n   *Exit criteria*: `shipped: true` from recognized repository stamp grammar.\n\n6. **Boundary Leak Safety Audit (Dual-Repo)**:\n   ```bash\n   python tools\u002Fscrub_public_copy.py --audit-staged\n   ```\n   *Exit criteria*: Exit code 0; zero private leak needles detected.\n\n7. **Residual Review Audit**:\n   ```bash\n   dos review origin\u002Fmain..HEAD\n   ```\n   *Exit criteria*: `has_residual: false`.\n\n8. **Clean Working Tree Audit**:\n   ```bash\n   git status --porcelain\n   fak sweep --json\n   ```\n   *Exit criteria*: All intended lanes and untracked WIP files committed cleanly; zero unowned residual debris.\n\n9. **Worktree Cleanup Verification**:\n   ```bash\n   fak worktree worker list --json\n   ```\n   *Exit criteria*: Allocated worktree is removed or cleanly marked `CLEANUP_READY`.\n","# \u002Fgit-subagent-sync — Synchronize Subagent Changes to Git on Shared Trunk\n\nCoordinated, conflict-free synchronization protocol for parallel subagents and isolated workers operating on the shared trunk (`main`). By default, discovers, arbitrates, validates, and synchronizes **all lanes and all untracked WIP** across the repository (or narrows to an explicit `--lane` or `--paths` when provided). Prevents index lock collisions, uncommitted file cross-talk, branch drift, and peer clobbering by strictly enforcing coordinator-mediated git mutations, disjoint filesystem leases via `dos arbitrate`, detached build-isolation worktrees, and non-forgeable witness gates.\n\n## Core Invariants\n\n1. **`main-is-single-source`**: All committed work lands directly on trunk (`main`). Feature branches, side branches, and divergent branch worktrees are prohibited. The repository trunk guard rejects off-trunk transactions with `OFF_TRUNK`.\n2. **All lanes & untracked WIP by default**: In the absence of an explicit `--lane` or `--paths` constraint, synchronization automatically inventories the complete working tree, discovers all untracked WIP files (`??`), maps untracked files to their canonical lanes, arbitrates leases per lane, and drives each lane through isolated validation, package tests, atomic landing, and DOS witness gates.\n3. **Untracked WIP preservation**: Untracked source files (`??`) are first-class candidate WIP. They are mapped to their respective lane via `dos.toml` and committed as part of their package; they are never wiped, abandoned, or hidden behind wildcard `.gitignore` rules.\n4. **Explicit paths only (No blanket staging)**: Git staging and landing operations require explicit pathspecs. \"All lanes\" does NOT mean `git add -A` or a blanket commit; it means iterating over all dirty lanes and landing each lane group with explicit pathspecs and its bindable `(fak \u003Clane>)` stamp.\n5. **Detached worktrees only**: Concurrent filesystem isolation utilizes detached HEAD worktrees pinned at an explicit trunk SHA (`git worktree add --detach \u003Cpath> \u003Csha>` managed via `fak worktree worker prepare`). Never attach branch worktrees.\n6. **Safe Landing within Worker Boundaries**: Autonomous safe git sync landing (`fak sync check`, `fak sync reconcile --apply`, `fak commit --path`, `fak sync push`) is active by default working within each worker process upon test verification. Raw uncoordinated git commands (`git add -A`, raw unverified git commits\u002Fmerges) remain strictly prohibited.\n7. **Package-scoped verification only**: Verification executes within isolated scopes (`fak validate --mine \u003Cp>...` and targeted package tests under WSL\u002FLinux) without running unisolated global sweeps that contaminate clean builds with peer WIP.\n8. **Autonomous landing upon task completion by default**: When an agent, worker, or subagent completes any assigned task, it must follow the safe landing process itself by default working within each worker process rather than leaving uncommitted edits or waiting for interactive prompts. If coordinator context preservation or build isolation is required, the coordinator dispatches a dedicated landing\u002Fworker subagent to execute the verification and landing steps autonomously.\n9. **Safe Merge & Structured Convergence**: Strictly forbid unverified raw merges, `--autostash`, or force-pushes. Check for `.git\u002FMERGE_HEAD` (`MERGE_IN_PROGRESS`); if active, halt and wait. Integrate upstream via `fak sync check` and `fak sync reconcile --apply` (supporting `ROUTE_DISJOINT_INTEGRATE`, `ROUTE_SUPERSET_MERGE`, and `ROUTE_HOLD_DIRTY_COLLISION` with `fak wip park`).\n10. **Dual-Repo Synchronization (`fak` & `fak-private`)**: When cross-repo dependencies, shared interfaces (`pkg\u002F*`), or companion platform modules are touched, synchronize both repositories. Check dirty states, fetch remotes for both, fast-forward both (`fak sync reconcile --apply` in `fak`, `git pull --ff-only` or `fak-sync repo` in `fak-private`), run `go work sync`, and verify boundary leak safety (`python tools\u002Fscrub_public_copy.py --audit-staged`).\n11. **Strict Ban on PowerShell & Loose Scripts (Mandatory Modular Go Programs)**: Workers and subagents MUST NEVER author `.ps1` (PowerShell), `.sh`, `.bat`, or loose scripts. All new automation, tooling, testing, or lifecycle utilities MUST be implemented as modular, integrated Go programs (`cmd\u002F*`, Go leaves registered as `fak` CLI verbs, or quarantined sub-modules under `tools\u002F\u003Cname>\u002Fgo.mod`) providing long-term value. Unless there is an extraordinary, super heavily justified reason (~1 in entire repo), loose scripts are strictly banned.\n\n## Architecture & Roles\n\n```\n[Upstream Trunk: origin\u002Fmain]\n              │\n      Coordinator Process\n    ┌─────────┴─────────┐\n    │  - Pre-flight checks & fak sync check\n    │  - Full working-tree inventory (modified + all untracked WIP)\n    │  - Lane classification via `fak sweep --json` & `dos.toml`\n    │  - Multi-lane arbitration loop: `dos arbitrate` per lane\n    │  - Allocate detached worktree: `fak worktree worker prepare`\n    │  - Ingest receipts & verify independently (`fak validate`, `go test`)\n    │  - Atomic lane landing: `fak sweep --apply` \u002F `fak commit --path`\n    │  - Commit witness per lane: `dos commit-audit`, `dos verify`\n    │  - Handle no-lane residuals (goals, root configs)\n    │  - Final review audit: `dos review origin\u002Fmain..HEAD`\n    │  - Cleanup: `fak worktree worker reap` & lease release\n    └─────────┬─────────┘\n              │ (Fenced Worktree \u002F Write Boundary)\n      Subagent \u002F Worker\n    ┌─────────┴─────────┐\n    │  - Bounded implementation in allocated file tree\n    │  - Private compilation cache: GOCACHE, GOTMPDIR\n    │  - Local package unit tests\n    │  - Autonomous safe git landing: `fak sync check`, `fak sync reconcile --apply`, `fak commit --path`, `fak sync push`\n    │  - Emit structured completion receipt with commit SHA\n    └───────────────────┘\n```\n\n### Coordinator Responsibilities\n- Discover layout and active repository state via `dos doctor`, `git status --porcelain`, and `fak sweep --json`.\n- By default, inventory **all lanes and all untracked WIP**, grouping untracked files into their canonical lanes.\n- Acquire exclusive lane leases from `dos arbitrate` before initiating subagent dispatch or landing.\n- Provision detached worktree isolation via `fak worktree worker prepare` with dedicated build cache roots (`GOCACHE`, `GOTMPDIR`, `DISPATCH_WORKSPACE`).\n- Ingest worker completion receipts without trusting narrative assertions (\"tests pass\", \"complete\").\n- Independently verify candidate deltas per lane using isolated compilation checks (`fak validate --mine`) and targeted package test suites.\n- Execute atomic landing on trunk per lane using `fak sweep --apply --lane \u003Clane>`, `fak worktree worker land`, or locked explicit-path staging (`fak commit --path`).\n- Witness each landed commit via `dos commit-audit HEAD`, `dos verify fak \u003Cleaf>`, and `dos review`.\n- Reap detached worktrees and release lane leases upon completion.\n\n### Worker \u002F Subagent Responsibilities\n- Execute modifications strictly inside the declared file tree or assigned detached worktree directory.\n- Use isolated compiler directories defined in the environment.\n- Run local tests inside the private worktree or target package.\n- Adhere strictly to safe trunk landing: NEVER execute raw uncoordinated git commands (`git commit`, `git push`, `git checkout -b`, `git add -A`, `git reset`, or `git merge`). Instead, execute landing through the guarded fak verbs: `fak sync check`, `fak sync reconcile --apply`, `fak commit --path`, and `fak sync push` unprompted by default upon test verification.\n- Return a structured completion receipt specifying modified files, newly created files, test outputs, execution status, and the landed origin commit SHA.\n\n## Step-by-Step Execution Protocol\n\n### Phase 1: Pre-Flight, Full-Tree Census & Lane Discovery (All Lanes by Default)\n\n1. **Refresh upstream tracking and verify safe merge state**:\n   ```bash\n   fak sync check --fetch\n   fak sync reconcile --apply\n   ```\n   Inspect for mid-flight merges:\n   ```bash\n   test ! -f .git\u002FMERGE_HEAD || exit 4 # MERGE_IN_PROGRESS\n   ```\n   If a merge is active, pause and allow the owning process to resolve it. Never abort, reset, or finish a peer's merge.\n\n   **Dual-Repo Pre-flight (when cross-repo dependencies, shared interfaces `pkg\u002F*`, or companion modules are involved)**:\n   When coordinating changes across both `fak` and `fak-private`:\n   - Inspect dirty state in both checkouts (`git status --porcelain`).\n   - Fetch remotes and lock refs for both repositories (`fak sync check --fetch` in `fak`, `git fetch origin` \u002F `fak-sync repo` in `fak-private`).\n   - Inspect `.git\u002FMERGE_HEAD` in both checkouts; if either repository is in a merge state, unstage local paths and wait.\n   - Run `go work sync` to verify multi-module workspace graph alignment across both trees.\n\n2. **Verify index lock availability**:\n   Verify `.git\u002Findex.lock` is absent. If present, inspect lock staleness rather than forcing removal.\n\n3. **Full Working-Tree Inventory (Tracked + All Untracked WIP)**:\n   Capture the full dirty census across all lanes:\n   ```bash\n   git status --porcelain\n   fak sweep --json\n   ```\n   Parse all modified, deleted, and untracked (`??`) files:\n   - **Package source & tests**: map each untracked file to its canonical lane according to `dos.toml [lanes]` (e.g. `cmd\u002Ffak\u002Farms.go` -> `cmd`, `internal\u002Fcompute\u002Fnuma_topology.go` -> `compute`, `internal\u002Fgateway\u002Farms.go` -> `gateway`).\n   - **Goal specifications**: map `goals\u002F**` to the `goal` lane or `internal\u002Fgoalregistry`.\n   - **Documentation & notes**: map `docs\u002F**` to the `docs` lane.\n   - **Tooling & test scripts**: map `tools\u002F**` to the `tools` lane.\n   - **Root residuals**: group root-level files (`Makefile`, `campaign-baseline.json`) for explicit leaf stamping.\n\n4. **Determine Scope (All Lanes vs Explicit Lane)**:\n   - If `--lane \u003Clane>` or `--paths \u003Cp>...` is explicitly passed, narrow execution to that specific lane or pathset.\n   - **Default**: Select **all discovered lanes** with dirty tracked or untracked WIP files for sequential synchronization.\n\n### Phase 2: Multi-Lane Arbitration & Ordering\n\n1. **Order Discovered Lanes**:\n   Sort discovered lanes to land dependencies before dependents (e.g. core libraries `internal\u002Fmodel`, `internal\u002Fcompute`, `internal\u002Fgateway` before entrypoints `cmd\u002Ffak`, and docs\u002Ftooling after code).\n\n2. **Acquire Exclusive Lane Lease**:\n   For each target lane in the queue, query the lane arbiter before modifying or committing:\n   ```bash\n   dos arbitrate --workspace . --lane \u003Clane> --kind keyword --mode exclusive --tree \u003Clane_paths>...\n   ```\n   Ensure outcome is `acquire`. If outcome is `refuse`, proceed to the next disjoint lane or back off if blocked by transient contention (`LOCK_BUSY`).\n\n3. **Provision Detached Worktree (When Dispatching Isolated Subagents)**:\n   When coordinating isolated workers, allocate a detached worktree directory pinned to trunk `HEAD`:\n   ```bash\n   fak worktree worker prepare --lane \u003Clane> --key \u003Ctask-or-issue-id>\n   ```\n   Capture `worker_worktree` and `base_sha` from the JSON payload.\n\n### Phase 3: Per-Lane Receipt Ingestion & Independent Verification\n\nFor each lane being synchronized:\n\n1. **Audit touched files against arbitration fence**:\n   Extract modified and untracked paths for this lane. Assert every path belongs to the arbitrated file-tree lease. Reject unmapped paths outside the lease (`COLLISION_RISK`).\n\n2. **Validate prospective delta in isolation**:\n   Run isolated compilation, formatting, and vetting across the lane's modified AND untracked paths:\n   ```bash\n   fak validate --mine \u003Clane_paths>...\n   ```\n   Confirm build, vet, and formatting pass while masking peer WIP.\n\n3. **Execute targeted test witness on-device**:\n   Run package tests for the target lane (WSL\u002FLinux on Windows):\n   ```bash\n   go test -v .\u002Finternal\u002F\u003Clane>\u002F...\n   go vet .\u002Finternal\u002F\u003Clane>\u002F...\n   ```\n   Proceed only when execution yields `CLAIM_TEST_GREEN`. Never accept worker-narrated test success without coordinator verification.\n\n### Phase 4: Per-Lane Atomic Trunk Landing\n\nFor each verified lane:\n\n1. **Prepare Conventional Commit subject**:\n   Format subject line with DCO sign-off (`-s`) and bindable lane trailer `(fak \u003Cleaf>)`:\n   ```\n   \u003Ctype>(\u003Cscope>): \u003Cconcise summary> (fak \u003Cleaf>)\n   ```\n\n2. **Lint commit message and paths**:\n   ```bash\n   fak commit --preview -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" --path \u003Clane_paths>...\n   ```\n\n3. **Safe divergence handling and merge routing**:\n   Before executing landing, check if upstream advanced during arbitration or verification:\n   - Strictly avoid unverified raw git merges, `--autostash`, or force-pushes.\n    - Route divergence through structured reconciliation:\n      ```bash\n      fak sync check\n      fak sync reconcile --apply\n      ```\n      Execute the evaluated safe route:\n      - `ROUTE_APPLY`: clean fast-forward convergence via `fak sync reconcile --apply` (or `fak sync apply`).\n     - `ROUTE_DISJOINT_INTEGRATE`: disjoint commit file-trees merged cleanly.\n     - `ROUTE_SUPERSET_MERGE`: textless `-s ours` verified convergence.\n     - `ROUTE_HOLD_DIRTY_COLLISION`: if uncommitted local paths collide, park them safely via `fak wip park` (or `--suspend-paths`), converge, and reapply.\n   - Re-verify prospective package tests with `fak validate --mine` after convergence before landing the commit.\n\n4. **Execute atomic trunk landing**:\n   **Option A — In-Tree Lane Sweep Landing (`fak sweep --apply`)**:\n   ```bash\n   fak sweep --apply --lane \u003Clane> -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" [--push]\n   ```\n   **Option B — In-Tree Locked Commit (`fak commit --path`)**:\n   ```bash\n   fak commit \\\n     --path \u003Cp1> --path \u003Cp2> ... \\\n     -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" \\\n     [--push]\n   ```\n   **Option C — Detached Worktree Landing (`fak worktree worker land`)**:\n   ```bash\n   fak worktree worker land \\\n     --worktree \"\u003Cworker_worktree>\" \\\n     --paths \u003Clane_paths>... \\\n     --verify go-build \\\n     --msg-file \"\u003Cprepared-msg-file>\"\n   ```\n\n   For a recovery-capable local attempt, carry the **original granted** Source\n   tuple on direct land and on **both** verified `land prepare` \u002F `land accept`:\n   `--source-lease-id \u003Cid> --source-lease-holder \u003Cholder> --source-lease-generation \u003Cpositive-generation>`.\n   The Source ref must be in the **target repository's Git common store**. The\n   worker validates the live tuple and verifies its current ref OID in the same\n   Git transaction as final trunk CAS. Direct-ref type and live tuple are rechecked\n   while Git's prepared ref locks are held, before the commit decision; TTL is a\n   decision-time check, not a zero-duration wall-clock expiry guarantee.\n   A heartbeat changes OID, not the immutable\n   presented tuple. Prepared receipts bind `source_lease`; omission or relabeling\n   at accept refuses. Missing\u002Fexpired\u002Fsuperseded leases refuse. Transaction\n   contention requires actual ref readback before retry; it is not proof of an\n   observed no-mutation terminal. Fenced requests never use shared-index legacy\n   or pending-debt modes. Existing no-tuple calls remain unfenced compatibility;\n   installing this code does **not** fence any already-running older binary or\n   prove that an unknown historical process drained. No cross-clone arbitration\n   or atomic sibling-repository lease\u002Ftarget transaction is claimed.\n\n5. **Verify commit claim shape & leaf stamp immediately**:\n   ```bash\n   dos commit-audit HEAD\n   dos verify fak \u003Cleaf>\n   ```\n   Confirm verdict is `OK` (`diff-witnessed`) and `shipped: true`.\n\n6. **Reap worker worktree if used**:\n   ```bash\n   fak worktree worker reap --worktree \"\u003Cworker_worktree>\" --superseded-by HEAD\n   ```\n\n### Phase 5: No-Lane Residuals, Push & Multi-Lane Summary Receipt\n\n1. **Synchronize No-Lane Residuals**:\n   For any remaining untracked files with no auto-inferred lane:\n   - `goals\u002F**`: commit with stamp `(fak goal)` or record in goal lifecycle.\n   - Root configs \u002F tooling (`Makefile`, `campaign-baseline.json`): commit with explicit paths and matching leaf (e.g. `(fak build)`, `(fak devindex)`).\n   - Proven disposable junk: clean with `fak sweep --clean-junk` or `fak tree-doctor --sweep-scratch`.\n\n2. **Confirm zero residual review debt**:\n   ```bash\n   dos review origin\u002Fmain..HEAD\n   ```\n   Confirm `has_residual` is `false`.\n\n3. **Push to trunk & dual-repo coordination**:\n   If `--push` was requested or trunk is green, push landed commits safely.\n\n   **Single-repo push (`fak` only)**:\n   ```bash\n   fak sync push\n   ```\n   `fak sync push` automatically retries non-fast-forward races when a peer lands between fetch and push while HEAD already contains origin, and halts safely on genuine divergence.\n\n   **Dual-repo push (`fak` & `fak-private`)**:\n   When cross-repo dependencies, shared interfaces (`pkg\u002F*`), or companion platform modules were modified:\n   - Audit the staged\u002Fcommitted public delta for private leak needles before push:\n     ```bash\n     python tools\u002Fscrub_public_copy.py --audit-staged\n     ```\n     Ensure zero leak needles (exit code 0).\n   - Push companion `fak-private` changes first or synchronously using its sanctioned workflow (`fak-sync push --apply`).\n   - Push `fak` commits via `fak sync push`.\n   - Confirm both repositories have reached their intended synchronized tip.\n\n4. **Emit structured sync receipt**:\n   ```json\n   {\n     \"schema\": \"fak-subagent-sync\u002F1\",\n     \"mode\": \"all-lanes\",\n     \"lanes_synced\": [\"agent\", \"compute\", \"gateway\", \"cmd\"],\n     \"untracked_wip_cleared\": 43,\n     \"commits\": [\n       {\n         \"lane\": \"agent\",\n         \"commit_sha\": \"\u003Csha1>\",\n         \"paths\": [\"internal\u002Fagent\u002Fblackboard_bench_test.go\", \"internal\u002Fagent\u002Fsubagent_synthesis.go\"],\n         \"witness\": { \"test\": \"CLAIM_TEST_GREEN\", \"audit\": \"diff-witnessed\", \"stamp\": \"shipped\" }\n       },\n       {\n         \"lane\": \"compute\",\n         \"commit_sha\": \"\u003Csha2>\",\n         \"paths\": [\"internal\u002Fcompute\u002Fdecode_numapool.go\", \"internal\u002Fcompute\u002Fnuma_topology.go\"],\n         \"witness\": { \"test\": \"CLAIM_TEST_GREEN\", \"audit\": \"diff-witnessed\", \"stamp\": \"shipped\" }\n       }\n     ],\n     \"status\": \"ALL_LANES_COMMITTED\"\n   }\n   ```\n\n## Refusal & Recovery Matrix\n\n| Refusal Token | Exit Code | Trigger Condition | Exact Recovery Action |\n|---|---|---|---|\n| `LOCK_BUSY` | 3 | Another process holds `.git\u002Findex.lock` or the advisory commit lock. | Wait with backoff (e.g. 500ms, 1s, 2s). In multi-lane mode, proceed to next disjoint lane or wait for lock release; do not remove active locks manually. |\n| `WRITER_LEASE_HELD` | 3 | Worktree writer lease held by an active sync-apply window (#4240). | Transient contention. Back off and poll until writer lease clears, then retry landing. |\n| `MERGE_IN_PROGRESS` | 4 | A git merge is active (`.git\u002FMERGE_HEAD` exists). | Strictly forbid unverified raw merges, `--autostash`, or force-pushes. If the merge is owned by a peer, do not abort or finish it; unstage local paths and wait. If resolving owned convergence, integrate via `fak sync reconcile --apply` (or `fak sync apply` `--ff-only`) or `fak sync reconcile` (`ROUTE_DISJOINT_INTEGRATE` \u002F `ROUTE_SUPERSET_MERGE` \u002F `ROUTE_HOLD_DIRTY_COLLISION` with `fak wip park`). |\n| `PATHSPEC_RACE` | 1 | Staged commit contained files outside the requested explicit pathspec. | Commit was held locally unpushed. Inspect `git show --stat HEAD`, verify unrequested paths, unstage them, and never force-push. |\n| `PUSH_REJECTED` | 1 | Remote rejected push (non-fast-forward conflict on origin). | Never force-push or rebase with `--autostash`. Run `fak sync check`, then `fak sync reconcile --apply` (or `fak sync apply`), re-verify affected packages, and push with `fak sync push`. If cross-repo work was landed, synchronize and push both `fak` and `fak-private`. |\n| `STALE_BASE_DELETION` | 4 | Working copy predates upstream modifications and would silently overwrite peer lines. | Refresh modified paths from `origin\u002Fmain`, reapply the subagent delta onto the fresh baseline, re-run tests, and re-commit. |\n| `STALE_UNTRACKED` | 4 | Path is untracked locally but already exists on origin\u002Fmain. | Local HEAD is behind remote. Run `fak sync check --fetch` and compare via `git show origin\u002Fmain:\u003Cpath>` before landing. |\n| `COLLISION_RISK` | 4 | Requested write tree overlaps with a concurrent active lease holder. | Run `dos arbitrate --workspace .` to inspect conflicting holders. Wait for lease expiration or select an alternate disjoint lane from `free_clusters`. If dirty paths collide during convergence, park conflicting WIP via `fak wip park` (`ROUTE_HOLD_DIRTY_COLLISION`). |\n| `DUAL_REPO_SKEW` | 4 | Interface mismatch or un-synchronized commits between `fak` and companion `fak-private` across shared packages (`pkg\u002F*`). | Synchronize remotes for both repos, run `go work sync`, re-verify interface compatibility across workspaces, and align commits. |\n| `PUBLIC_LEAK_DETECTED` | 1 | Staged or committed public copy contains private needles or credentials. | Run `python tools\u002Fscrub_public_copy.py --audit-staged`, scrub offending private artifacts, and never push until leak check exits 0. |\n| `OFF_TRUNK` | 4 | Current working tree is detached or checked out on a branch other than `main`. | Return to trunk via `fak sync apply` (or `git checkout main`). Sanctioned worker worktrees (`fak worktree worker`) are exempt when landing via CAS. |\n| `CORE_SELF_MODIFY` | 4 | Attempted modification of frozen\u002Fcore-locked files (e.g. `internal\u002Fabi\u002F**`, policy anchors). | Abort unauthorized modification. If permitted by maintenance mandate, provide explicit `--core-lock-maintenance-witness \u003Cclaim>`. |\n\n## Verification and Witness Gate\n\nEvery execution of `git-subagent-sync` must pass the following checkable verification commands before declaring synchronization complete:\n\n1. **Prospective Build & Vet Isolation**:\n   ```bash\n   fak validate --mine \u003Cpaths>...\n   ```\n   *Exit criteria*: Exit code 0; zero compile errors, gofmt clean, vet clean.\n\n2. **Targeted Package Test Execution**:\n   ```bash\n   go test -v .\u002Finternal\u002F\u003Clane>\u002F...\n   go vet .\u002Finternal\u002F\u003Clane>\u002F...\n   ```\n   *Exit criteria*: Exit code 0; status is `CLAIM_TEST_GREEN`.\n\n3. **Commit Subject & Leaf Lint**:\n   ```bash\n   fak commit --preview -m \"\u003Ctype>(\u003Cscope>): \u003Csummary> (fak \u003Cleaf>)\" --path \u003Cpaths>...\n   ```\n   *Exit criteria*: Exit code 0; Conventional Commits syntax valid, DCO present, trailer matches active lane.\n\n4. **Diff Witness Verification**:\n   ```bash\n   dos commit-audit HEAD\n   ```\n   *Exit criteria*: Verdict `OK`, witness category `diff-witnessed`.\n\n5. **Stamp Recognition**:\n   ```bash\n   dos verify fak \u003Cleaf>\n   ```\n   *Exit criteria*: `shipped: true` from recognized repository stamp grammar.\n\n6. **Boundary Leak Safety Audit (Dual-Repo)**:\n   ```bash\n   python tools\u002Fscrub_public_copy.py --audit-staged\n   ```\n   *Exit criteria*: Exit code 0; zero private leak needles detected.\n\n7. **Residual Review Audit**:\n   ```bash\n   dos review origin\u002Fmain..HEAD\n   ```\n   *Exit criteria*: `has_residual: false`.\n\n8. **Clean Working Tree Audit**:\n   ```bash\n   git status --porcelain\n   fak sweep --json\n   ```\n   *Exit criteria*: All intended lanes and untracked WIP files committed cleanly; zero unowned residual debris.\n\n9. **Worktree Cleanup Verification**:\n   ```bash\n   fak worktree worker list --json\n   ```\n   *Exit criteria*: Allocated worktree is removed or cleanly marked `CLEANUP_READY`.\n",{"name":5,"metadata":24,"description":7,"allowed-tools":26,"argument-hint":27,"user-invocable":28,"disable-model-invocation":20},{"opencode":25},"agent-permission","Read, Bash, Write, Edit, Grep, Glob, Task","[--lane \u003Clane>] [--paths \u003Cp>...] [--worker-dir \u003Cdir>] [--push] (defaults to all lanes and all untracked WIP)",true,"main","f565b7b7db63e79649f3a02c08108132a86c5d05",".claude\u002Fskills\u002Fgit-subagent-sync",16,"https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak","https:\u002F\u002Fanthony-chaudhary.github.io\u002Ffak\u002Fshowcase.html","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary","https:\u002F\u002Flinkedin.com\u002Fin\u002Fanthonychaudhary","2026-11-15 03:06:00",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":28},[40,43,46],{"tool":41,"command":42},"npx","npx skills add anthony-chaudhary\u002Ffak --skill git-subagent-sync",{"tool":44,"command":45},"bunx","bunx skills add anthony-chaudhary\u002Ffak --skill git-subagent-sync",{"tool":47,"command":48},"pnpm","pnpm dlx skills add anthony-chaudhary\u002Ffak --skill git-subagent-sync","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fgit-subagent-sync\u002FSKILL.md",[],[52,59,68,75,82,87],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M78V4059KRP2T88YR6Z05MJQ","serve-receipt","On-demand research protocol + deterministic receipt for serving a Hugging Face model on a concrete GPU target — fan out research lanes (model facts\u002Ffiles, engine support matrix, serving recipes, KV\u002Fstate memory math), compute the tiered feasibility verdict with `fak serve-receipt` (never narrated math), and emit a witnessed launch receipt. Use when asked for an \"initial config\", \"serving receipt\", or \"how do I serve \u003Cmodel> on \u003CGPUs>\".","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fserve-receipt\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":63,"licenseFileUrl":64,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M77HRGKQV2CJ2K6ZFN4YQ32K","caveman","Ultra-compressed communication mode. Cuts output tokens 65% (measured) by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says \"caveman mode\", \"talk like caveman\", \"use caveman\", \"less tokens\", \"be brief\", or invokes \u002Fcaveman. Also auto-triggers when token efficiency is requested.","MIT","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002Finternal\u002Fsyspromptmmu\u002Fthird_party\u002Fcaveman\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002Finternal\u002Fsyspromptmmu\u002Fthird_party\u002Fcaveman\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M77HRAY3Y3BE7APN5PVJF7NV","quality-report","Score the repo quality and emit a report card.","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002Finternal\u002Fctxplans\u002Ftestdata\u002Frepo\u002F.claude\u002Fskills\u002Fquality-report\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M77HR9807KHAX13DG9PW2K2Q","ctx-overlay","Compact the context window and prune the memory store when a session grows too long.","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002Finternal\u002Fctxplans\u002Ftestdata\u002Frepo\u002F.claude\u002Fskills\u002Fctx-overlay\u002FSKILL.md",[],[],{"skillNo":83,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M77HR7XQ9X8F2CY9Z4F2ZEZ3","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002Finternal\u002Fctxplanlint\u002Ftestdata\u002Frepo\u002F.claude\u002Fskills\u002Fquality-report\u002FSKILL.md",[],[],{"skillNo":88,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M77HR5BVKCTR1WNJGRBSDNX7","https:\u002F\u002Fgithub.com\u002Fanthony-chaudhary\u002Ffak\u002Fblob\u002Fmain\u002Finternal\u002Fctxplanlint\u002Ftestdata\u002Frepo\u002F.claude\u002Fskills\u002Fctx-overlay\u002FSKILL.md",[],[]]