Governance system for maintaining fork-specific divergences during upstream syncs.
This fork (randomm/opencode) tracks upstream (anomalyco/opencode). Features declared here survive merges intentionally — nothing gets silently overwritten.
.fork-features/
├── manifest.json # Feature registry — what we own, how to verify it
├── verify.ts # Standalone bun test — checks features survived a merge
├── README.md # This file
└── reports/ # Dated sync run reports (institutional memory)
The AI command that drives syncs lives at .opencode/command/sync-upstream.md.
Run /sync-upstream inside opencode. What happens:
- Agent reads manifest.json and last 3 sync reports for context
- Fetches upstream and analyzes the gap (commits grouped by area)
- Checks absorption signals — if upstream absorbed a feature, STOPS and asks you
- Creates sync branch, merges upstream
- Resolves conflicts using manifest knowledge (criticalCode markers)
- Runs verify.ts to confirm all fork features survived
- Runs full test suite and typecheck
- Writes a dated report to
reports/ - Presents summary and recommends merge if green
/sync-upstream dry-run — analysis only (steps 1-3), no merge.
/sync-upstream report-only — reads and summarizes past reports.
Add an entry to manifest.json:
"my-feature": {
"status": "active",
"description": "What it does",
"newFiles": ["packages/opencode/src/my-feature.ts"],
"modifiedFiles": ["packages/opencode/src/existing.ts"],
"criticalCode": ["myFeatureFunction", "MY_FEATURE_FLAG"],
"tests": ["packages/opencode/test/my-feature.test.ts"],
"upstreamTracking": {
"absorptionSignals": ["myFeatureFunction", "my.*feature"]
}
}Run bun test .fork-features/verify.ts to baseline.
Set status to "dropped" or "upstream-absorbed". The verifier skips it. Log the reason in the next sync report.
During sync, the command checks upstream changes against each feature's absorptionSignals. If upstream code matches:
- Auto-pauses — presents upstream vs our code
- User decides: keep ours, adopt upstream's, or merge both
- Decision is recorded in the sync report
Each sync writes a report to reports/ (e.g., 2026-02-06-sync.md). Reports contain:
- Upstream commit range merged
- Conflicts and resolutions
- Feature verification results
- Absorption alerts and decisions
- Pain points and recommendations
The agent reads past reports before each sync for institutional memory.