Skip to content

Feature: Implement XDG symlink farm for tool-owned files #198

Description

@trevor-vaughan

Problem

uf init deploys 33 embedded Markdown files into every repository. Of these, 17 are tool-owned — identical across repos, auto-updated by uf init. The other 16 are user-owned (customized per repo, never overwritten). The tool-owned/user-owned split is already cleanly modeled in internal/scaffold/scaffold.go via the isToolOwned() function (line 286).

Centralizing the tool-owned files would reduce per-repo file counts, make version upgrades propagate instantly across repos, and keep git history focused on project-specific content.

Proposed Solution

Move tool-owned files to ~/.config/uf/scaffold/ (following XDG conventions, aligning with Replicator's existing ~/.config/uf/replicator/ path) and create symlinks from the repo.

What moves to XDG (17 files)

Category Count Current Path XDG Path
Commands 6 .opencode/command/*.md ~/.config/uf/scaffold/command/*.md
Canonical packs 5 .opencode/uf/packs/{default,go,typescript,content,severity}.md ~/.config/uf/scaffold/packs/*.md
Skills 1 .opencode/skill/speckit-workflow/SKILL.md ~/.config/uf/scaffold/skill/...
Schemas 5 openspec/schemas/unbound-force/** ~/.config/uf/scaffold/schemas/...

What stays in the repo (16 files)

  • All 12 agent persona files (.opencode/agents/*.md) — user-owned, intentionally customized per repo
  • 4 custom convention pack stubs (*-custom.md) — user-owned extension points

Implementation scope

The refactor touches exactly 3 files:

File Change
internal/scaffold/scaffold.go Add xdgScaffoldDir(), mapAssetToXDGPath(), writeXDGFile(), ensureSymlink() helpers; modify Run() walk callback; add Linked to Result struct
internal/scaffold/scaffold_test.go ~8 modified tests, ~20 new tests (symlink creation, idempotency, fallback, migration)
cmd/unbound-force/main.go Add --no-symlinks flag

No new files. No new dependencies. All Go stdlib (os.Symlink, os.Readlink, os.Lstat, os.UserConfigDir, os.Remove).

Design constraints

  • CI/CD workflows do not depend on .opencode/ files — unaffected
  • Convention pack gitignore must be per-file (.opencode/uf/packs/go.md is symlinked; go-custom.md is tracked)
  • XDG path must be injectable via XDGConfigDir field in Options struct for testability
  • Concurrent uf init is safe — XDG writes are deterministic per version

Additional Considerations

  • The addition of a uf sync tool with profiles would be ideal for pulling from a central, authoritative, location (git repo, etc...)

Alternatives

  • Implement the stack as composable lola components and allow the user to choose whether material is global or project local

Acceptance Criteria

  • Implement symlink creation in the scaffold engine via isToolOwned() seam
  • Store tool-owned files at ~/.config/uf/scaffold/
  • Symlinks are gitignored; recreated by uf init after clone
  • Add fallback to file copying when symlinks fail (Windows without developer mode, network filesystems)
  • Migrate existing deployments automatically on uf init
  • Add --no-symlinks flag for opt-out
  • OpenCode, Claude Code, and Cursor all follow symlinks transparently (verify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions