-
Notifications
You must be signed in to change notification settings - Fork 2
Sync Flow
type: concept up: "Template-vs-Derived-Projects" extends: "Template-vs-Derived-Projects" tags: [sync, maintenance]
How template improvements propagate from the template repository to existing derived projects.
Since PR #60 (merged 2026-06-28), the sync contract lives in a single file: scripts/lib/template-manifest.sh. scripts/update-from-template.sh, scripts/check-template-version.sh, and scripts/adopt.sh all source it and assemble their working set from its arrays via lw_manifest_assemble_active_files. To add or remove a template-synced file, edit the manifest and nothing else. This page describes the array roles; the file lists themselves are deliberately not duplicated here — the manifest is the source of truth, and the previous version of this page proved that a copied list rots (see Wiki-Corrections-Log).
The six arrays, as of template main @ c19eec8 (2026-07-01):
32 files that ship to every derived project regardless of overlay: llm-wiki.md, wiki/init-wiki.sh, the wiki/agents/*.md shared docs, both sync scripts, the feature-flag scripts, the whole scripts/lib/*.sh shared library, features/README.md, and the scripts/wiki-write-protocol/ tree.
The per-agent files (13 Claude Code, 6 Cursor). In update/check the overlay is activated by directory presence on disk (.claude/ or wiki/agents/claude-code/; .cursor/ or wiki/agents/cursor/); in adopt it is activated by the --agent flag.
The wiki-* slash commands, skills, and cursor rules (10 files) ship with literal {{REPO_NAME}} tokens that must be substituted by the derived project's $REPO_NAME after copy.
CLAUDE.md (managed-block), .gitignore (append-only), .claude/settings.json (merge). update-from-template does not touch these at all — .gitignore in particular moved here from the old always-synced list; the post-sync report prints an advisory when the host's .gitignore diverges from the template's, and the host back-ports manually. Adopt uses these entries to seed its default TOUCH grants.
Documentation-only record: scripts/instantiate.sh (self-deletes after a successful instantiation), CLAUDE.md.template, README.md.template, .claude/settings.json.template, .cursorrules.template. The sync logic does not iterate over this array.
scripts/kg/ (the Knowledge-Graph-Pipeline, shipped in PR #14) exists in the template repo but is not in the manifest's sync arrays. Derived projects therefore do not automatically receive the KG pipeline on update-from-template.sh. The current plan is to ship it as an opt-in feature under features/kg/ (using the feature-flag framework from RFC #13) rather than promoting it to TEMPLATE_SHARED_INFRA.
Historically, adding a new template file required updating parallel arrays in both sync scripts (and later a third copy in adopt.sh). Forgetting one was silent: derived projects simply never received the file, while the per-overlay procedures that reference it found a dead reference. PR #1 hit this for both discipline-gates.md and verification-gate.md; Priscila caught it as review point 3. See Lesson-Parallel-File-Drift.
The manifest consolidation (PR #60) closed the class: there is one array set, and two test fixtures lock the contract — scripts/test/tests/unit/manifest-shape/ enforces the cross-array invariants (every path exists in the tree, no double-ownership, every substitute entry contains {{REPO_NAME}}), and scripts/test/tests/smoke/manifest-convergence/ proves adopt and instantiate produce a convergent on-disk file set.
scripts/check-template-version.sh compares a derived project's last-synced template commit against the template's current main. The .llm-wiki-template-log.md file in the derived project records sync history. Keeping this file in git gives a permanent trail; the template's .gitignore makes it commit-or-not at the project's discretion.
update-from-template.sh runs in the derived project's main repo, not the wiki sub-repo. It does not push; the derived project decides when and whether to publish the sync as a commit.
- Template-vs-Derived-Projects
- Agent-Overlays
- Lesson-Parallel-File-Drift
-
Lesson-Gitignore-Anchor-Propagation: scope-sensitive content (leading-slash
.gitignoreentries) shipped through the then-current always-synced list matched the wrong root in derived repos;.gitignoreis host-owned since PR #60 -
Knowledge-Graph-Pipeline: the
scripts/kg/payload that is not in the manifest's sync arrays - Governance: the three-tier model that frames where new template assets get placed
- Implementation-Status: current real-vs-aspirational classification
- Wiki-Corrections-Log: receipts for the 2026-05-31 rewrite of this contract section and the 2026-06-12 KG-now-implemented correction
- OKF-Alignment-Ideas: if convention changes land for OKF alignment, propagation flows through the manifest's sync arrays
- Knowledge-Bundles-Framing: paper-brief synthesis that names sync-flow as one of the discipline-layer mechanisms above OKF