Yes—upstream can stay clean.
The remote-tracking ref upstream/main records the latest fetched state of pingdotgg/t3code. A separate accepted-baseline tag records the exact upstream commit that T3 Trades has reviewed and admitted.
03 · Git operating model
T3 Trades can preserve an exact, auditable reference to pingdotgg/t3code. It cannot promise that a long-lived trading fork will merge future upstream changes without conflicts. Every upstream batch is reviewed, tested, and accepted deliberately.
3.1 · Direct answer
The remote-tracking ref upstream/main records the latest fetched state of pingdotgg/t3code. A separate accepted-baseline tag records the exact upstream commit that T3 Trades has reviewed and admitted.
T3 Trades will modify orchestration, MCP, persistence, provider-session, and UI seams that upstream also changes. Conflicts and behavioral regressions remain possible even when Git reports a clean merge.
Operating decision. “Clean upstream” means an unmodified reference with preserved Git ancestry. It does not mean rebasing away T3 Trades history, auto-merging upstream, or claiming semantic compatibility without conformance evidence.
3.2 · Current-state gap
market-bender has no Git metadataThis site directory has no .git, remotes, branches, shared history, or repository-level ignore file. It cannot currently prove or maintain ancestry with T3 Code.
The executable T3 Trades product must live in a repository forked from pingdotgg/t3code with its commit history intact. This specification site remains independent and records decisions, audit pins, and verified outcomes.
Do not initialize this site directory and copy T3 Code into it. That would mix a static specification with the product monorepo and weaken upstream provenance.
3.3 · Remote and reference model
upstreamhttps://github.com/pingdotgg/t3code.git
sync/upstream-YYYY-MM-DD-<shortSHA>One explicit upstream batch merged into one review branch.
Conflicts, migrations, tests, and behavior changes are resolved here.originThe organization-owned T3 Trades fork; origin/main is its protected product branch.
| Reference | Meaning | May move? |
|---|---|---|
upstream/main | Remote-tracking ref for the newest upstream commit fetched locally. It is observation, not approval. | Yes, after git fetch upstream. |
upstream-base/YYYY-MM-DD-<shortSHA> | Annotated tag on the immutable upstream SHA accepted by T3 Trades after review and conformance. | No. Create a new tag for the next batch. |
main / origin/main | Protected downstream integration and release branch in the writable fork. | Yes, through reviewed pull requests only. |
3.4 · Branch map
upstream/mainObserved upstreamMoves when fetched; never treated as accepted automatically.upstream-base/YYYY-MM-DD-<shortSHA>Accepted baselineImmutable annotated tag on the upstream SHA admitted by review.sync/upstream-YYYY-MM-DD-<shortSHA>Batch integrationTemporary review branch; one exact upstream range per pull request.main / origin/mainProduct truthProtected downstream branch containing reviewed trading work.feature/trading-*Execution unitsShort-lived branches based on main.3.5 · Copyable runbook
Run this only with a new, empty writable product repository after its URL, approved upstream SHA, acceptance date, fork version, and branch-protection policy are decided. Replace all placeholders before execution.
# Clone upstream history, then assign conventional remote ownership.
git clone --single-branch --branch main \
https://github.com/pingdotgg/t3code.git t3-trades
cd t3-trades
git remote rename origin upstream
git remote add origin https://github.com/<YOUR_ORG>/t3-trades.git
# Fetch only upstream main; make accidental upstream pushes fail.
git config remote.upstream.fetch \
"+refs/heads/main:refs/remotes/upstream/main"
git remote set-url --push upstream DISABLED
git config remote.pushDefault origin
git fetch --prune upstream
# Create product main from the explicitly approved upstream baseline.
APPROVED_SHA="<FULL_APPROVED_UPSTREAM_SHA>"
ACCEPTANCE_DATE="<YYYY-MM-DD>"
FORK_VERSION="<T3_TRADES_FORK_VERSION>"
git cat-file -e "${APPROVED_SHA}^{commit}"
if ! git merge-base --is-ancestor "$APPROVED_SHA" upstream/main; then
echo "Approved SHA is not an ancestor of upstream/main; stop." >&2
exit 1
fi
BASE_SHORT_SHA="$(git rev-parse --short=8 "$APPROVED_SHA")"
BASE_TAG="upstream-base/${ACCEPTANCE_DATE}-${BASE_SHORT_SHA}"
git switch -C main "$APPROVED_SHA"
# Publish product main, then propose the canonical baseline record.
git push -u origin main
DOWNSTREAM_MAIN_SHA="$(git rev-parse main)"
git switch -c "feature/trading-baseline-${BASE_SHORT_SHA}" main
mkdir -p docs/upstream
printf '%s\n' \
"# Accepted upstream baseline" \
"" \
"- Accepted upstream SHA: \`$APPROVED_SHA\`" \
"- Downstream main SHA: \`$DOWNSTREAM_MAIN_SHA\`" \
"- Accepted tag: \`$BASE_TAG\`" \
"- Acceptance date: \`$ACCEPTANCE_DATE\`" \
"- Fork version: \`$FORK_VERSION\`" \
> docs/upstream/BASELINE.md
git add docs/upstream/BASELINE.md
git commit -m "Document initial accepted upstream baseline"
git push -u origin "feature/trading-baseline-${BASE_SHORT_SHA}"
# Stop. Review and accept this baseline-record PR before publishing the tag.
Re-enter the approved values, verify that the reviewed record is now on origin/main, and only then publish the immutable tag.
set -eu
git fetch --prune origin \
"+refs/heads/main:refs/remotes/origin/main"
APPROVED_SHA="<FULL_APPROVED_UPSTREAM_SHA>"
ACCEPTANCE_DATE="<YYYY-MM-DD>"
FORK_VERSION="<T3_TRADES_FORK_VERSION>"
BASE_SHORT_SHA="$(git rev-parse --short=8 "$APPROVED_SHA")"
BASE_TAG="upstream-base/${ACCEPTANCE_DATE}-${BASE_SHORT_SHA}"
if ! git merge-base --is-ancestor "$APPROVED_SHA" origin/main; then
echo "Approved upstream SHA is not contained in origin/main; stop." >&2
exit 1
fi
BASELINE_RECORD="$(git show origin/main:docs/upstream/BASELINE.md)"
printf '%s' "$BASELINE_RECORD" | grep -F -- "$APPROVED_SHA" >/dev/null
printf '%s' "$BASELINE_RECORD" | grep -F -- "$BASE_TAG" >/dev/null
printf '%s' "$BASELINE_RECORD" | grep -F -- "$FORK_VERSION" >/dev/null
if git rev-parse -q --verify "refs/tags/${BASE_TAG}" >/dev/null ||
git ls-remote --exit-code --tags origin \
"refs/tags/${BASE_TAG}" >/dev/null 2>&1; then
echo "Accepted baseline tag already exists; stop rather than overwrite it." >&2
exit 1
fi
git tag -a "$BASE_TAG" "$APPROVED_SHA" \
-m "Accepted T3 Code baseline ${APPROVED_SHA} for ${FORK_VERSION}"
git push origin "$BASE_TAG"
The DISABLED push URL makes an accidental upstream push fail. Repository permissions remain the authoritative enforcement layer.
3.6 · Reviewed batch sync
upstream/main SHA, commit range, release notes, migrations, and changed high-risk seams.upstream/main descends from the prior accepted tag. Any rewritten or missing ancestry stops the batch for provenance review.sync/upstream-YYYY-MM-DD-<shortSHA> from local main; merge the captured upstream SHA—not the moving ref—with a merge commit.main. If accepted, review the canonical baseline-record update, then publish its immutable tag. If rejected, close the batch without changing either record or tag.The exact packageManager, Node engine, and script definitions at the candidate accepted upstream SHA are authoritative. The commands below match the upstream observed on 28 July 2026; inspect the captured SHA before every batch and update the runbook when its repository scripts change.
Capture and print the immutable upstream SHA. Copy it into the pull-request ledger; do not expect a shell variable to survive review.
set -eu
git fetch --prune upstream \
"+refs/heads/main:refs/remotes/upstream/main"
git switch main
git pull --ff-only origin main
# Capture immutable endpoints before creating the review branch.
PREVIOUS_BASE_TAG="<CURRENT_UPSTREAM_BASE_TAG>"
PREVIOUS_BASE_SHA="$(git rev-list -n 1 "$PREVIOUS_BASE_TAG")"
OBSERVED_SHA="$(git rev-parse upstream/main)"
if ! git merge-base --is-ancestor "$PREVIOUS_BASE_SHA" "$OBSERVED_SHA"; then
echo "Observed upstream does not descend from the accepted base; stop." >&2
exit 1
fi
SYNC_DATE="$(date -u +%F)"
OBSERVED_SHORT_SHA="$(git rev-parse --short=8 "$OBSERVED_SHA")"
SYNC_BRANCH="sync/upstream-${SYNC_DATE}-${OBSERVED_SHORT_SHA}"
git switch -c "$SYNC_BRANCH"
git merge --no-ff "$OBSERVED_SHA"
# Resolve owned conflicts and update the patch ledger, then run both suites.
corepack enable
corepack install
pnpm install --frozen-lockfile
pnpm run typecheck
pnpm run lint
pnpm run test
# Run the T3 Trades conformance command selected in Phase 0.
git push -u origin "$SYNC_BRANCH"
printf 'Copy to the PR ledger:\nOBSERVED_SHA=%s\nSYNC_BRANCH=%s\n' \
"$OBSERVED_SHA" "$SYNC_BRANCH"
Copy the full observed upstream SHA and the exact accepted sync merge commit SHA from the accepted pull request and its ledger. Do not infer either value from the current local HEAD.
set -eu
git fetch --prune origin \
"+refs/heads/main:refs/remotes/origin/main"
# Paste immutable values from the accepted PR and ledger.
ACCEPTED_OBSERVED_SHA="<FULL_OBSERVED_UPSTREAM_SHA>"
ACCEPTED_SYNC_MERGE_SHA="<FULL_ACCEPTED_SYNC_MERGE_COMMIT_SHA>"
ACCEPTED_DATE="<YYYY-MM-DD>"
FORK_VERSION="<T3_TRADES_FORK_VERSION>"
git cat-file -e "${ACCEPTED_OBSERVED_SHA}^{commit}"
git cat-file -e "${ACCEPTED_SYNC_MERGE_SHA}^{commit}"
if ! git merge-base --is-ancestor \
"$ACCEPTED_SYNC_MERGE_SHA" origin/main; then
echo "Accepted sync merge is not contained in origin/main; stop." >&2
exit 1
fi
if ! git merge-base --is-ancestor \
"$ACCEPTED_OBSERVED_SHA" "$ACCEPTED_SYNC_MERGE_SHA"; then
echo "Observed upstream SHA is not contained in the accepted merge; stop." >&2
exit 1
fi
OBSERVED_SHORT_SHA="$(git rev-parse --short=8 "$ACCEPTED_OBSERVED_SHA")"
BASE_TAG="upstream-base/${ACCEPTED_DATE}-${OBSERVED_SHORT_SHA}"
# Propose the canonical provenance record before publishing its tag.
git switch --detach origin/main
git switch -c "feature/trading-baseline-${OBSERVED_SHORT_SHA}"
mkdir -p docs/upstream
printf '%s\n' \
"# Accepted upstream baseline" \
"" \
"- Accepted upstream SHA: \`$ACCEPTED_OBSERVED_SHA\`" \
"- Downstream main SHA: \`$ACCEPTED_SYNC_MERGE_SHA\`" \
"- Accepted tag: \`$BASE_TAG\`" \
"- Acceptance date: \`$ACCEPTED_DATE\`" \
"- Fork version: \`$FORK_VERSION\`" \
> docs/upstream/BASELINE.md
git add docs/upstream/BASELINE.md
git commit -m "Document accepted upstream baseline"
git push -u origin "feature/trading-baseline-${OBSERVED_SHORT_SHA}"
# Stop. Review and accept this baseline-record PR before publishing the tag.
Re-enter the two accepted commit SHAs and the record metadata. Verify both ancestry relationships and the reviewed canonical record before publishing the tag.
set -eu
git fetch --prune origin \
"+refs/heads/main:refs/remotes/origin/main"
ACCEPTED_OBSERVED_SHA="<FULL_OBSERVED_UPSTREAM_SHA>"
ACCEPTED_SYNC_MERGE_SHA="<FULL_ACCEPTED_SYNC_MERGE_COMMIT_SHA>"
ACCEPTED_DATE="<YYYY-MM-DD>"
FORK_VERSION="<T3_TRADES_FORK_VERSION>"
if ! git merge-base --is-ancestor \
"$ACCEPTED_SYNC_MERGE_SHA" origin/main; then
echo "Accepted sync merge is not contained in origin/main; stop." >&2
exit 1
fi
if ! git merge-base --is-ancestor \
"$ACCEPTED_OBSERVED_SHA" "$ACCEPTED_SYNC_MERGE_SHA"; then
echo "Observed upstream SHA is not contained in the accepted merge; stop." >&2
exit 1
fi
OBSERVED_SHORT_SHA="$(git rev-parse --short=8 "$ACCEPTED_OBSERVED_SHA")"
BASE_TAG="upstream-base/${ACCEPTED_DATE}-${OBSERVED_SHORT_SHA}"
BASELINE_RECORD="$(git show origin/main:docs/upstream/BASELINE.md)"
printf '%s' "$BASELINE_RECORD" | grep -F -- "$ACCEPTED_OBSERVED_SHA" >/dev/null
printf '%s' "$BASELINE_RECORD" | grep -F -- "$ACCEPTED_SYNC_MERGE_SHA" >/dev/null
printf '%s' "$BASELINE_RECORD" | grep -F -- "$BASE_TAG" >/dev/null
printf '%s' "$BASELINE_RECORD" | grep -F -- "$FORK_VERSION" >/dev/null
if git rev-parse -q --verify "refs/tags/${BASE_TAG}" >/dev/null ||
git ls-remote --exit-code --tags origin \
"refs/tags/${BASE_TAG}" >/dev/null 2>&1; then
echo "Accepted baseline tag already exists; stop rather than overwrite it." >&2
exit 1
fi
git tag -a "$BASE_TAG" "$ACCEPTED_OBSERVED_SHA" \
-m "Accepted upstream ${ACCEPTED_OBSERVED_SHA} via ${ACCEPTED_SYNC_MERGE_SHA}"
git push origin "$BASE_TAG"
3.7 · Conflict ownership
| Changed surface | Required owner | Acceptance evidence |
|---|---|---|
| Provider sessions, MCP, orchestration, persistence | T3 integration owner | Resume binding, event ordering, migrations, restart, and no-provider-substitution tests. |
| Authority, risk, signing, execution, reconciliation | Trading safety owner | Boundary, idempotency, partial-fill protection, canonical-state, and emergency-control tests. |
| Contracts shared across both domains | Both owners | Schema compatibility, version migration, and end-to-end mission-loop evidence. |
| Workspace and operator controls | Product UI owner | Loading, empty, error, stale, blocked, mobile, keyboard, and accessibility checks. |
The author of a conflict resolution does not provide its only approval. Safety-critical and shared-contract changes require an independent reviewer.
3.8 · Guardrails
upstream/main remains a remote-tracking observation, not a writable product lane.
Bots may report drift and open a branch; they may not accept a batch.
Use merge commits so accepted upstream batches remain traceable.
Correction creates a new commit or tag with an explicit explanation.
Do not paste T3 Code into this site or an unrelated repository.
upstream/main moving does not move the accepted SHA or claim compatibility.
3.9 · Cadence and freeze
Freeze the accepted baseline when release conformance starts. Only a documented critical security or correctness fix may reopen it; reopening invalidates prior evidence and reruns the complete gate.
3.10 · Phase 0 proof
Observed 28 July 2026 (Asia/Kolkata). The audited baseline is a direct ancestor of the then-current observed upstream head.
55dd01612efc51e19de479da5a0e348cbe2521e3887dd6e455bb969c1a0c9659a6bdf2baceac030d55dd016 is an ancestor of 887dd6eA clean reference branch can move from the audited baseline to the observed upstream head by fast-forward. Upstream provenance remains intact.
No T3 Trades product branch exists yet, so conflict resolution, semantic compatibility, and conformance against those two commits remain untested.
git merge-base --is-ancestor \
55dd01612efc51e19de479da5a0e348cbe2521e3 \
887dd6e455bb969c1a0c9659a6bdf2baceac030d
git rev-list --left-right --count \
55dd01612efc51e19de479da5a0e348cbe2521e3...\
887dd6e455bb969c1a0c9659a6bdf2baceac030d
# Expected on 28 July 2026: 0 2
3.11 · Open decisions and exit gate
APPROVED_SHA used to create product main.origin resolves to the writable product fork.upstream resolves to pingdotgg/t3code and rejects pushes.upstream/main fetches only upstream main and matches the recorded observed SHA.main and origin/main have protected direct ancestry from that SHA.Stop condition. If ancestry, remote ownership, baseline identity, or required conformance cannot be proven, no trading implementation phase begins.