aiwf-reallocate

Resolves duplicate entity id collisions by renumbering one entity and rewriting all references.

Updated May 9, 2026
One-click install
npx skills add https://github.com/23min/aiwf --skill aiwf-reallocate-23min
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: aiwf-reallocate
Source: https://github.com/23min/aiwf/tree/main/internal/skills/embedded/aiwf-reallocate
Command: npx skills add https://github.com/23min/aiwf --skill aiwf-reallocate-23min

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When two branches of an aiwf-tracked project independently allocate the same entity id and are then merged, aiwf check reports an ids-unique finding and the pre-push hook blocks the push. This Skill resolves that collision safely instead of leaving you to hand-edit frontmatter and break cross-references. ## Core Features & Use Cases - Automatic renumbering: Runs aiwf reallocate to pick the next free id (max + 1 across the working tree and trunk), git mv the colliding entity, and rewrite every reference field in other entities' frontmatter. - Trunk-ancestry tiebreaker: When an id is ambiguous, the side whose add commit is an ancestor of the trunk ref keeps the id; otherwise you pass a path to disambiguate. - Lineage preservation: Appends the old id to the entity's prior_ids list so aiwf history still returns the full timeline for both the old and new ids. - Use Case: After merging a teammate's branch, aiwf check fails with an ids-unique error on gap-7. Invoke this Skill to renumber one side, rewrite all milestone and gap references, and commit the fix with structured trailers. ## Quick Start Ask the AI to resolve the duplicate id reported by aiwf check by running aiwf reallocate on the colliding entity.

Frequently Asked Questions about aiwf-reallocate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix an ids-unique error from aiwf check?

Run `aiwf reallocate <id>` to renumber one of the colliding entities. The tool picks the next free id, moves the file with git mv, and rewrites reference fields in every other entity's frontmatter automatically.

What happens when two entities share the same id after a git merge?

aiwf applies a trunk-ancestry tiebreaker: the side whose add commit is an ancestor of the trunk ref keeps the id, and the other side is renumbered. If both or neither are on trunk, it refuses and asks you to pass a path to disambiguate.

Does aiwf history still work after an id is reallocated?

Yes. The old id is appended to the entity's prior_ids frontmatter list, and `aiwf history` resolves the queried id through that chain. Both the old and new ids return the same chronological timeline including pre-rename and post-rename commits.

Can I fix an id collision by editing frontmatter manually?

No. Hand-editing the id in frontmatter leaves references in other entities pointing at the old id, breaking the tree. Always use `aiwf reallocate`, which rewrites all reference fields and commits with proper trailers.

When should I not run aiwf reallocate?

Only run it when an ids-unique finding actually exists. Renumbering non-colliding entities rewrites history and references for no benefit, and body-prose mentions of old ids still require manual human review afterward.